if pathogens do entre the body the immune system will recognise them and produce antibodies
white blood cells can engulf foreign cells and digest them - this is called phagocytosis
when some types of white blood cells come across foreign antigens they will produce a protein called antibodies to lock onto that specific antigen. antibodies are then produced rapidly and carried around the body
if the person get infected again by the same pathogen the white blood cells will rapidly reproduce the antibodies to kill it - the person is naturally immune to that pathogen they wont get ill