“You are the average of the five people you spend the most time with” applies here
I forget where the term comes from, but in some social science there's a conception of prisons as "universities of crime"
The 1995 film "Heat" refers to them as "gladiator academies". And there's a great Willem Dafoe film called about the US prison system called "Animal Factory".
Now apply that logic to homeless people.
We shouldn’t be putting homeless people in prison either. What’s your point?
He probably meant something like "Having no contact with anyone except homeless people for a long time has to change a person."