1800, used by British physician Edward Jenner (1749-1823) for the technique he publicized of preventing smallpox by injecting people with the similar but much milder cowpox virus (variolae vaccinae), from vaccine (adj.) "pertaining to cows, from cows" (1798), from Latin vaccinus "from cows," from vacca "cow," a word of uncertain origin. A mild case of cowpox rendered one immune thereafter to smallpox. "The use of the term for diseases other than smallpox is due to Pasteur" [OED].
The earlier 18c. method of smallpox protection in England was by a kind of inoculation called variolation (fromvariola, the medical Latin word for "smallpox"). There are two forms of smallpox: a minor one that killed 2% or less of the people who got it, and a virulent form that had about a 30% mortality rate and typically left survivors with severe scarring and often blinded them. Those who got the minor form were noted to be immune thereafter to the worse. Doctors would deliberately infect healthy young patients with a local dose of the minor smallpox, usually resulting in a mild case of it at worst, to render them immune to the more deadly form. Jenner's method was safer, as it involved no smallpox exposure.