It helps the immune system recognize the pathogen and be more aware about the pathogen for a certain period of time. Therefore if a LIVING version of that pathogen were to enter the immune system, the immune system would be able to react to the pathogen quicker.