Stolen from here: https://social.marxist.network/@yogthos/113583918563324620
New York City already provides shelter space for anyone who asks. It’s the city’s obligation according to the state constitution. (This is one reason why so many migrants came to NYC.) The homeless people in the subway system generally don’t want to go to a shelter.
As for treating the underlying issues: many of these people are either schizophrenics or drug addicts. There’s no straightforward treatment for either condition.
If the solution was as easy as you think it is, someone would have already done it.