A vaccination is a way to keep animals (both people and other kinds of animals) from getting sick when viruses get inside their bodies. The earliest kind of vaccination was when people noticed that if you had already had the sickness and gotten better, you couldn’t catch it a second time. This is true for many diseases caused by viruses, like measles, chickenpox, or smallpox.
Nobody knows for sure when people figured this out, but it was probably long before the Greek historian Thucydides wrote that during a terrible plague at Athens (possibly measles), “the sick and the dying were tended by the pitying care of those who had recovered, because they knew the course of the disease and were themselves free from apprehensions. For no one was ever attacked a second time, or not with a fatal result”.
This works because your body fights off a virus by making antibodies – special cells that evolve just to fight that particular kind of virus. If you catch a virus, then your body makes antibodies and learns how to fight that kind of virus. Then if you catch that virus again, your body is already prepared to fight back
By about 1000 AD, doctors in India and China knew that you could give someone immunity from smallpox without them ever actually having the disease. The doctor gave you just a little bit of the disease (powdered scabs from smallpox sores), rubbed into a small cut, or breathed in through your nose, and that caused your body to make antibodies that could fight off the virus if you caught it. By the 1400s, doctors were using this method all over the Ottoman Empire and in East Africa.
Doctors in Europe finally learned about this method of giving someone immunity from smallpox in the 1700s AD. They developed the hypodermic needle, in France and England in the 1850s AD, thanks to newly invented cheap steel. Needles helped doctors to begin vaccinating people against many other viruses as well. They could inject a little bit of the virus into people’s arms or legs. But vaccinations don’t work for all viruses – some viruses, like the viruses that cause AIDS or hepatitis, evolve very fast and change their shape, so that old antibodies won’t work on new forms of the virus.