When a virus or bacteria enters the body, the immune system recognises it as foreign and produces the right cells, antibodies, and biochemical responses to eliminate the invader.