This question is fairly vague. if you could add a time period / region of the world you could probably get better answers.
I am attempting to look up some notes from when I studied some of this... oh gosh 10-12 years ago. I did find an article that highlights some of what I do remember.
Part of my background is in intercultural studies. A part of that was studying "folk religions" and understanding the spiritual undertones of why a society or group/tribe makes decisions. See the case of how certain areas are currently dealing with Ebola and you can see the importance of understanding the long history and spirituality of a community before offering aid and help.
But... take a community. And add a newborn child with defects of some kind. We have a lot more definitions and understandings now. But the whole gamut of birth defects causes a reaction in the community.
For many communities an illness or handicap means some form of sin, immorality, or karmic expression. What did you do to cause your child to be born that way?
Different cultures/communities responded differently. If i could locate my sources I could be much more exact but for example- locking someone up in the attic. there are stories of this type of thing happening. But I was actually quite encouraged by how many cultures across history took care of the sick or those born with defects in a community focused wholistic way.
Of course, there are rituals in some areas of East Africa where spiritualist and medicine men would try to cast out demons and evil spirits within. (the US has a decent history of this as well) There are some areas where the mindset is much more of this person is a part of our community. We did something (or their parents did) to cause this. So our penance is to take care of this child as a community. Lastly, there are stories throughout history of children born resembling gods in India that meant the child received much more care, food, and wealth than they would otherwise.
So you have different communities at different times handling the mentally handicapped as a community (not likely they were locked up), as individual family units, and as wards of the state. As a community, they may use ritual, spirituality, and medicinal properties to push out whatever 'bad' was inside. or they may have taken care of the needs of the community member as a collective. Sometimes, the child was even worshipped.
It is a very interesting topic throughout history. How we treat the outsiders is fascinating. Even those that are within our own tribe. Even biblical history shows some distinct differences. Lepers is the common example- but in spite of spiritual rules around being clean or unclean a society as a whole still had a responsibility to meet the needs of those within. (almsgiving, gleaning, and a few other practices). Fascinating stuff.
Edit: Dangit, the post I was replying to got deleted =(
Going along with infanticide, Chinese history has interesting writings from before BC (that is a weird phrase to use) BCE about the topic.
Han Fei is a famous philosopher from ~250BC who did a good deal of writing about the role of law and government (by the aristocrats).
While this, in itself, is interesting because of the logistical problems of enforcement in that era and gleaning an understanding about the practical nature of a totalitarian government, it is the comments and comparisons to infanticide used by Han Fei that are of immediate interest.
It was the custom in pre-Ch’in China that the birth of a boy would be required and congratulated, but a new-born girl would be killed. The interpretation Han offered for this practice focused on […] the calculation of long-term interests. source
There is a legitimate question of how biased Han Fei was though given that he was of the aristocratic class. How much of what he wrote was tinted by his class and actions?
But to present a case for the original question, the most common way to deal with unwanted children during this time/place looks to be death.
Edit 1: Another example of Han Fei using infanticide as an analogy for the need for a totalitarian goverment:
Han Fei used infanticide of baby daughters to show that “even parents treat their offspring with calculation of gain” and concluded that humaneness, love and benevolence are useless. To rectify the conduct of a delinquent youth, parental love, neighborly advice, and teachers’ persuasion are no match for intimidation back by penal punishment. source
Removed for trivia/throughout history.