Vaccines are designed to train the immune system to recognize and combat pathogens. They introduce a harmless component of the pathogen, such as a protein or an inactivated virus, to the body. This stimulates the immune system to produce antibodies and memory cells, preparing it to respond more effectively to future infections by the same pathogen.