The virus that causes shingles — varicella-zoster virus — is also the virus that causes chickenpox. Your doctor's concern may stem from reports of rare cases in which people with no immunity to chickenpox — meaning they've never had chickenpox or the chickenpox vaccine — have caught varicella-zoster virus from children recently vaccinated with the chickenpox vaccine.
However, there are no documented cases of the varicella-zoster virus being transmitted from adults vaccinated with the shingles vaccine, according to the Centers for Disease Control and Prevention (CDC).
Your doctor's caution also refers to the previous shingles vaccine (Zostavax) that is a live-attenuated vaccine, meaning it uses a weakened form of the live virus. A new shingles vaccine (Shingrix) was approved by the U.S. Food and Drug Administration in 2017. The new vaccine is inactivated, meaning it uses a dead version of the virus, eliminating the risk of transmission.
Varicella-zoster vaccines are approved for children age 12 months and older to prevent chickenpox and for adults age 50 and older to prevent shingles, but the formulations are different, and the vaccines are not interchangeable.
According to the CDC, in normal circumstances it's unnecessary to avoid pregnant women and unvaccinated children after you get the shingles vaccine. However, if you are vaccinated with Zostavax and develop a rash, take the precaution of keeping it covered until all the bumps crust over.
To develop shingles, you have to catch chickenpox first, which typically happens in childhood. When you get over chickenpox, the varicella-zoster virus stays in your body, but remains dormant, often for many years and possibly for life. As you age, though, there's an increasing risk that the virus will reactivate, resulting in shingles.