Up to the 19th Century mentally ill people were sometimes chained naked in squalid conditions in places like London’s Bethlehem hospital which became synonymous with chaos (its name being contracted to bedlam) and where tourists would pay to see the freak show.Then came the extreme rationalism of the Kirkbride plan which created a very unusual form of architecture for asylums throughout the Anglosphere that was used until the 20th Century.
Until the Victorian era the mentally ill were being housed in county jails, private homes and the basements of public buildings. Kirkbride's Plan instituted a "Moral Treatment" that included sunlight and fresh air and looked to provide comfort for patients. These large institutions proved expensive to maintain and many were abandoned over the years or turned to other uses.
Link - Via Kottke