Vaccines contain antigens that cause your body to produce memory cells against a particular pathogen, without the pathogen causing disease. Vaccines reduce the occurrence of the disease, those not vaccinated are also less likely to catch the disease- this is called herd immunity.