In the 18th century it was common folk knowledge in Europe that milk maids (women who milked cows) seemed to be immune from the smallpox plagues when they swept through Europe.
In 1796, English physician Edward Jenner developed a vaccine for smallpox based upon this folk knowledge.
“Recognizing that dairymaids infected with cowpox were immune to small-pox, Jenner deliberately infected James Phipps, an eight year old boy, with cowpox in 1796. He then exposed Phipps to smallpox-which Phipps failed to contract. After repeating the experiment on other children, including his own son, Jenner concluded that vaccination provided immunity to smallpox.”
In the United States, compulsory smallpox vaccination was introduced on a state by state basis, beginning in the early 1800s.