Herd immunity occurs when a significant portion of a population becomes immune to an infectious disease, thereby reducing its spread. This can be achieved through vaccination or previous infection. Herd immunity protects those who are not immune by reducing the overall amount of the pathogen in the population.