Traditional Indian and Chinese Medicinal Systems sometimes deliberately rubbed the skin crusts from smallpox victims into the skin of healthy people. They thus hoped to induce a mild form of smallpox that would create resistance against the disease.
Famously, two centuries ago, an English physician named Edward Jenner, realized that milk maids who had Cowpox did not catch smallpox even during epidemics. Cowpox is a very mild disease. Jenner tried deliberately giving cowpox to people (as he can be seen doing in the picture), and found that they were now resistant to smallpox.
This was because the smallpox virus is closely related to the cowpox virus. "Cow' is vacca' in Latin, and cowpox is 'vaccinia'. From these roots, the word vaccination has come into our usage.