Attitudes began to change in the 18th century.

During the Enlightenment, mental illness began to be seen as something that could actually be treated (as opposed to something that could be exploited for a quick buck). And people began to want to do something about the insane.