It’s drilled into us every flu season: You should get a flu shot. That message is especially stressed for pregnant women, but new research has found that the health benefits are not just about the mother—flu shots can protect the baby for the first six months after birth.

The study, which was published in the journal Pediatrics, analyzed nearly 500,000 medical records and found that infants who were six months old and younger that were born to moms who got the flu vaccine had a 70 percent lower risk of contracting the flu and an 80 percent lower risk of being hospitalized for the flu compared to babies whose moms didn’t get the vaccine. Unfortunately, only 10 percent of the women studied reported getting the flu vaccine while pregnant, which put a lot of babies into the high risk category.

Another scary finding: 97 percent of laboratory-confirmed flu cases in infants happened to those whose mothers didn’t get the flu vaccine while they were pregnant.

Why can the flu vaccine help babies? “Pregnant women who are immunized against influenza during pregnancy provide maternal antibodies to their baby through the placenta,” lead study author Julie Shakib, D.O., an assistant professor of pediatrics at the University of Utah, tells SELF. Children younger than six months are too young to be vaccinated against the flu, she explains, so the best way to protect infants during that time is to make sure the mom got her flu shot during her pregnancy.

Getting the flu shot during pregnancy also protects the baby by lowering the odds the baby will be exposed to the viral infection in the first place. “One of the primary ways that any newborn will get an infection is transmission from an adult,” Denny Martin, D.O., an assistant professor and associate chair of the department of obstetrics, gynecology, and reproductive biology at Michigan State University, tells SELF. “Primary caregivers are in such close contact with the baby—if we can prevent the mom or other caregivers from getting infected, we can dramatically lower a baby’s risk of getting the flu.”

Board-certified infectious disease specialist Amesh A. Adalja, M.D., an assistant professor at the University of Pittsburgh Medical Center, tells SELF that it’s important for pregnant women to get a flu shot as soon as flu season hits in early fall to protect themselves (and their baby). However, he says, pregnant women should get the flu shot no matter where they are in their pregnancy—and it still can have benefits in the later stages. “Get it even if you’re going to give birth a month later,” he says.

While it’s important for moms to get the shot to protect themselves, Adalja says it may not protect the baby if a woman is less than two weeks away from her due date. Why? It takes about 14 days for your body to generate antibodies to the flu, which can then be passed on to the baby.

Bottom line: Experts say it’s crucial to get the flu shot when you’re pregnant. “Those maternal antibodies are the only way you’re going to protect that baby for the first six months of their life,” Adalja says.