Defensive vomiting
Defensive vomiting refers to the use of emesis to defend against ingested pathogens or, in animals, against predators. In humans
Vomiting serves an evolutionary purpose for humans by preventing the ingestion of something harmful, and by expelling noxious substances once ingested. Vomiting excessive amounts of alcohol is an attempt by the body to prevent alcohol poisoning and death. Vomiting may also be caused by other drugs, such as opiates, or toxins found in some foods and plants. Food allergies and sensitivities, such as lactose intolerance, can cause vomiting. Morning sickness may have a defensive purpose. One professor has posited that morning sickness discourages pregnant women from eating meat and strong-tasting vegetables, which may contain toxins and microorganisms. If ingested, the fetus might be harmed in the first 18 weeks of pregnancy. In animals
Turkey vultures will vomit to dispel any disturbing animal. They can propel their vomit up to . The European roller, a much smaller bird found in parts of Africa, Europe, Asia, and the Middle East, uses vomit in a different way. A baby European roller will vomit a foul-smelling orange liquid onto itself to turn away a predator. The smell also warns the parents to return to the nest, and to be wary of predators. See also
Area postrema, the part of the brain that controls vomiting
Chemoreceptor trigger zone, the part of the area postrema that relays signals through the blood-brain barrier

References

Reflexes
Vomiting