The problem is one of the alternatives they consider worse than homelessness is a life without opioids.
I had cousin who was homeless in San Diego. Over the years she came into money a couple times, either from family members or through inheritance. Instead of getting a place to live she figured drugs were a better use for that money. We tried everything to get her off the street, and nothing worked. She wouldn't even stay at a shelter. Because she had no intention of giving up the drugs.
They don’t want to be homeless but they don’t want to put up with free housing drug free rules so they prefer to stay on the streets where they can keep using.