The prevention of infection or disease following exposure to a pathogen.