Vaccines contribute to herd immunity by reducing the number of susceptible individuals in a population, thereby lowering the overall transmission of the disease. When a significant portion of the community is immune, the spread of the disease is limited, protecting those who cannot be vaccinated.