The answer to every social problem is not to make it a punishable offense, but to get at the causal factors. In many instances homeless people are outright mentally ill, and as such may pose an uncertain risk to the whole society. Others are harmless if their basic needs are seen to, like a place to bathe or use the toilet. It is when people don't have basic needs that they get desperate, and impulsive, and it is at precisely the worst moment that such people snap, and can cause massive destruction, even with the best of intentions. No one is isolated from anyone else, no matter how much they build up the illusion that they are.
All support is needed and invited.