Absolutely, some people need in patient medical care or rehab. But not everyone. And those often aren’t permanent things. Usually in patient care is only temporarily needed and a group home is a better and more scalable long term solution.
But the key is some people. Not everyone needs medical help. For one thing, there’s a huge number of homeless people who aren’t the stereotypical on the streets type, but rather living in shelters, friends’ sofas, or their cars. Some homeless people do just need a little help and way to support themselves or a safety net.
Some people are probably also using drugs to cope with being homeless. It certainly won’t be the case for every person, but I’m sure some number can absolutely turn things around after they’re no longer homeless (but not before). I mean, things are pretty bleak if you don’t have a safe place to live and sustain yourself. Can you really fault people for not wanting to give up drugs that make that shitty situation slightly less shitty?