Understand that vaccination results in the manufacture of memory cells, which enables future anti-body production to the pathogen to occur sooner, faster and in greater quantity.
In Vaccination, a type of pathogen is introduced into the blood stream (either dead or weakened). The biological word for weakened in attenuated and these pathogens cannot cause diseases. The fragments of the bacteria are introduced to the lymphocytes which produces plasma cells and memory cells. The reason why we vaccinate is because if this happens naturally, it will take time and during this time the organism may be killed or be very severely damaged. If we introduce cells which are attenuated they won't do any harm to the body and still help with the production of memory cells. So if the person actually catches the pathogen which are strong and harmful the pathogen would be quickly picked up and be eliminated before it harms our body.