The body has many defences to protect itself from harmful attack by bacteria or viruses. But to be effective, the body has to have had some experience of them. Then it will build up a supply of cells that know about the harmful microbe and kill it quickly.
If the first time the body's immune system comes across a harmful organism, it may be so overwhelmed that it cannot do its job and then the infected person is likely to die.
So the idea of immunisation is to give a small weak dose of the harmful organism that the body can easily deal with. Then it will build up a memory of how to cope. This weak dose is a vaccine.
The first vaccine was against smallpox. In 1798 Edward Jenner introduced innoculation with smallpox vaccine. In the 1880s Louis Pasteur developed immunisation methods for chicken cholera and anthrax in animals as well as for human rabies.
Since then many vaccines have been developed. Through the use of immunisations, some infections, for example polio, have almost completely been eradicated in many parts of the world. One example is polio. This is why is it SO important to be vaccinated when it is offered.