Herd immunity (also known as community immunity) arises when a large proportion of a population develops immunity to a disease, either through vaccination or prior infection. This subsequently safeguards individuals who are not immune by limiting the disease's ability to spread within the community.