
To my understanding the main reason asylums existed was as a catch-all for anybody with major disabilities or conditions. Since medicine has evolved, a lot of conditions can either be treated outright (antipsychotic meds, etc.) or only require outpatient facilities. Plus, there were a lot of ethical issues posed by having someone “put away” and the conditions were usually not great and the facilities became dumping grounds.
Most of the reasons that homeless people exist can be resolved by changes in economic policy or healthcare policy. A lot of homeless people are unemployed or underemployed, or simply have no means to access the mental health care they need to keep them psychiatrically stable. Modern psychiatric hospitals are needed for some, but all that asylums would do is just house them locked away from the rest of the population, which isn’t a solution and doesn’t address the problem.