Have you talked to any of them? Most of the ones I've talked to don't want anything to do with work. Yes, work on its own is not enough to rejoin society. But work is a prerequisite for rejoining society. It is necessary but not sufficient. If you don't want to work you cannot rejoin society.
At some point you need to assert some tough love and force them to do things they don't want to do. Like work. Or not drink/do drugs.
Your thinking is essentially the tough on crime mentality: Blindly lock people up until they behave the way you want them to. That's how the US ended up with the largest per capita prison population in this solar system and absolutely fucking nothing to show for it.
Tough on crime has failed. Spectacularly so. I wonder for how many more decades one can keep running in the wrong directions with fingers in their ears, telling themselves that approach will start working any day now.
Worse, your proposed punishment may actually constitute an improvement in living condition to the people you're trying to punish ("Off to free meals and a warm bed I go!"). Are you really willing to spend lots of money imprisoning people to give them what you could have given them for way cheaper, just so you can tell yourself you're "punishing" them? At that point one might as well stop pretending one has anyone's best interests in mind and admit to pettiness.
They probably don’t want to work cuz working low wage jobs is a shit experience and are one bad day from losing their job and becoming houseless again.
The vast majority of homeless people suffer from mental illness, and have come from broken homes - experienced severe childhood trauma.
These are people who, mostly, never had a chance. This is the key point. They were dealt a truly garbage hand in life, and no amount of 'pull yourself up by your bootstraps' is going to change that.
They need care, they need education, they need homes. They need people to invest years of work into their rehabilitation.
And, in pretty much any developed country, providing that is roughly equivalent in cost to what we currently spend punishing them.
The state is paying the cost of homelessness, but it is doing so in a fashion that both fails to solve the problem and makes the quality of life for these people even worse.