It is important to recall that the immune system is a complex network of intricate biological processes. These processes work together to identify and eliminate disease causing agents such as viruses, bacteria, and abnormal cells. The immune system operates as a constant process of separating native cells from malicious intruders.
This sounds like a tough job, and it is. The immune system is on constant high alert because viruses and bacteria are continuously mutating into never before seen strains.
When the immune system finds something it cannot recognize as native it begins the process of eliminating the intruder. Each time the immune system eliminates a foreign body it retains a memory of the encounter.