Herd immunity occurs when a high percentage of a population becomes immune to a disease, either through vaccination or previous infection. This reduces the overall spread of the disease, protecting those who are not immune, such as individuals who cannot be vaccinated for medical reasons. Vaccines are a key tool in achieving herd immunity and controlling outbreaks.