Babies given antibiotics or antacids in infancy may be at increased risk for allergies in childhood.

Researchers retrospectively studied 792,130 infants covered by a health insurance program. Of these, 131,708 received antibiotics, 60,209 got histamine-2 receptor antagonists and 13,687 were given proton pump inhibitors. Both H2 blockers and P.P.I.s are prescribed for gastroesophageal reflex, or GERD.

The study, in JAMA Pediatrics, followed the children for an average of four and a half years. It found that infants given H2 blockers or P.P.I.s were more than twice as likely to have a food allergy as those who were not; the risk was especially high for allergy to cow’s milk. Those given antibiotics were at a 14 percent increased risk for food allergy, a 51 percent increased risk for anaphylaxis (a potentially fatal type of allergic reaction), and more than double the risk for asthma.

The authors suggest that both antacids and antibiotics disrupt the normal intestinal bacteria and that this may explain the association.