Capitalism requires elite ownership over the means of subsistence, including land. Capitalism over the last several hundred years dispossessed most people, as the various histories of Enclosures will show, as will the important development of the industrial revolution where mechanized capitalist production outcompeted rural artisan/peasant economies. Rural people who had some control over land had to leave for urban centers to rent out their bodies and the landlords and real estate marketers prevailed, meaning some people became unwilling vagrants for lack of money.
Land rents in a capitalist market have no cost mechanisms accounting for human survival or dignity, only for profit to legal owners, therefore homeless people will exist under capitalism because private property laws enforce ownership-without-occupancy-and-use plus legal deeds and rent contracts and financially marginal people do not accumulate monetary value for owners, or at least they cannot compete with businesses and wealthier people.
In capitalism the cost of allowing very poor people with likely unstable work situations into buildings can become more of a financial liability than an income, and the poorest people will never compete successfully for space against powerful interests even if the rentiers have to wait for awhile. Homeless people are then forbidden with force from directly providing for themselves, once again because of the institution of private property as it exists.
Capitalist landlords prefer overpopulated situations because then the people have to compete with one another for the space they need, meaning the landlords make more money, which naturally leads to too many people and too little space, or some people winning (becoming housed) and some people losing (becoming houseless).
Homeless people also provide a useful bogeyman for capitalists because people will not risk their jobs struggling for better situations if they fear becoming the dispossessed class.
"There is one kind of prison where the man is behind bars, and everything that he desires is outside; and there is another kind where the things are behind the bars, and the man is outside." -Upton Sinclair.