The belief in possession by demons or evil spirits is one common in many worldwide religions. Within these religious contexts, many forms of behaviour that secular western medicine considers "mental illness" was assumed to be due to the acts of inimical spirits. As to whether one actually believes the such spirits exist and possess people, it depends upon your own religious tradition. Most scientists would say that the existence of such spirits has not been proven by scientific methods and that therefore they do not exist.
On the other hand, in such cases as people hearing voices, religious traditions such as exorcism are surprisingly successful at enabling the victims to lead a successful and productive life within their communities. As Foucault and many other theorists have argued, the medicalization of alternative ways of understanding the world has not been entirely successful as a form of treatment.
After exorcism rituals, which may involve using holy objects, prayers, laying on of hands, or magical transfer of the "demon" into a goat, many of the victims' symptoms are lessened or disappear, and thus whatever the mechanism, it is certainly an activity worth studying.