It is very unfortunate that this happened to your friend.
However, brief anecdotes like this are not incredibly useful without a great deal of additional information.
* Did your friend or others in her family have a history of mental illness?
* Was she depressed or otherwise suffering from mental illness at the time of the trip?
* Was she on any other drugs (prescribed or not) apart from ayahuasca?
* Had she had much previous experience with psychedelics?
* Did she try to fight the experience or was she able to surrender to it and go with the flow (a very important skill to have, when using psychedelics)?
* Was she in a safe environment, among trusted people during the trip?
* Did she have a concrete, positive intention for the trip? Or was she just taking it for the hell of it?
* How much did she know about what she was getting in to?
* How qualified was the shaman she took the brew with?
Unfortunately, many self-styled shamen don't have the proper training, or (occasionaly) any training at all. There could be incentive for people to misrepresent themselves and their credentials, especially when money is involved.
Yes, one should definitely be very careful, and avoid taking psychedelics when one or one's family has a history of mental illness, is currently suffering from mental illness (including plain old depression), or is using any other psychoactive medication (such as antidepressants, antipsychotics, etc).
You should also seriously check out the credentials of any shaman or guide you're taking the medicine with, and be sure you are in a safe, supportive environment during the trip.
Finally, thoroughly educate yourself on the substance and constructive ways of using it.
My friend did NOT have a history of mental illness. I think her dad may have had a little OCD, but nothing else that was obvious to me. I haven't followed up with her to ask her these, but this is what I think is true:
She was not on other drugs at all as far as I know.
I don't think she'd ever done psychedelics before.
I don't know too many details of the environment she did it in, but it was with an apparently-experienced shaman I think recommended by her yoga teacher friend. It was the yoga teacher who recommended to her that she try it. All that she knew, she likely heard from this friend who had done it before.
She is a Buddhist, but I don't know what her intentions were.
I don't know anything about the shaman.
I know that it was a medical doctor good friend of hers that committed her to the psych ward afterwords, so she really needed it.