Clayton Cramer researched this issue in depth and wrote a book on it. He reviews the history of the treatment of mentally ill people from pre-colonial days until present. It is well worth reading his book:
My Brother Ron: A Personal and Social History of the Deinstitutionalization of the Mentally Ill
He was motivated by the fact that his brother was mentally ill, frequently violently so, and yet there seemed to be no legal mechanism to deal with violence by seriously mentally ill people other than put them in prison for crimes.
He specifically looks into the issues of widespread wrongful committal and abuse of inmates in the institutional system, and it seems to me find rather weak support for it, especially for using it as justification for dismantling the whole thing. He notes that although the logic seemed to be that such people would be better treated in out-patient and community settings, in fact the out-patient and community-based treatment programs and centers were set up to treat entirely different sets of mental issues, and the folks who had serious, sometimes dangerous mental illnesses that previously got them committed were simply left to themselves. Although they might get treated if they showed up at a clinic, they were exactly the people who would not follow their therapy programs or take their medications without the strict supervision of an institutional setting (Instead they self-medicate with alcohol and drugs of their own choice). So they were left in the community, generally ended up on the streets because they couldn't keep their lives together enough to even take advantage of the various social safety nets, and there they stay until they commit a crime serious enough to lock them up. Even for the ones that had family that cared about them and tried to do something for them, there was no help if the patient chose not to cooperate --- until the patient decided to chop up his mother or shoot up a school or something similar.
It is sometimes noted that the rate of imprisonment has increased significantly over the last 30 or so years. This is usually in the context of criticizing the prison "industry" or sentencing laws or the war on drugs, something like that. But Cramer and others note that the actual rate of
incarceration in the US is actually a bit less than it was in the pre-WWII era. What has changed is
where people are incarcerated. If you add together the number of people in prison and the number of people committed to mental institutions prior to the 1960s and convert it to the rate of incarceration (i.e. number of people locked up divided by the population), then do the same for post 1960 era, you come up with rates that are nearly the same, with a drastic dip in between.
That dip in the 1960s was when state mental institutions were being closed, but not enough time had passed for the seriously mentally ill to begin entering the criminal justice system. In effect, the population of seriously mentally ill was simply transferred from mental institutions to prisons.
(Note also that closing state mental institutions and going to federally funded community treatment programs and such moved a huge debt burden from the states to the Federal government. Remember this was the era of "the Great Society" and a significant ramping up of the Federal Government's scope and power).
What do you think the opportunities for abuse of the mentally ill are in prisons, compared to that of an institution set up to treat, or at least safely house, a mentally ill person?