The immune system can be likened to the defence system of a country - its purpose is to monitor for, seek out and destroy "invaders" but not injure its citizens. In the case of the immune system, invaders are anything foreign to the horse’s body such as a virus, bacterium or parasite, or foreign material like pollen, dust or noxious gases. The immune system must be able to recognize that they are foreign and distinct from the horse’s own cells and tissues, even when differences are subtle. Further, the immune system must be able to "remember" what they look like.
The immune system is complex and composed of several branches or parts that interact with and support each other. Organisms and other foreign materials can gain relatively easy access to the horse via several portals such as the respiratory tract by inhalation or orally through the gastrointestinal tract. These areas of the body are well-adapted to help prevent entry or to efficiently remove foreigners should they enter. Examples of this include the mucus and microscopic hairs that line the upper respiratory tract to trap particles and "wave" them upward to be coughed out, and the low (acidic) pH of the stomach in which many organisms once swallowed, cannot survive. In fact, the entire skin surface provides a mechanical barrier to invaders. These entry areas are also home to certain specialized cells that act as 'gate-keepers’ and produce an immune response locally.
However, should something invade the horse’s body, it will be dealt with by the antibodies produced by the horse’s immune system AND/OR it will be picked up and handled by certain specialized cells that ultimately will destroy it.
When we vaccinate a horse, we introduce an organism (or organisms) in a slightly altered form from the "real" organism into the horse, wherein it is recognized as "foreign" and subsequently stimulates the immune system to produce antibodies against it. At the same time, "memory" cells are also produced to remember what this organism looks like. Should the horse meet the real organism in the field, the immune system's prior stimulation through vaccination ensures that antibody production will be faster and greater to protect the horse from becoming ill.
Some organisms activate the other specialized cells previously mentioned, which are the integral part of the cell-mediated immune response. However, not all vaccines appear to be able to stimulate a cell-mediated immune response. Vaccines that do promote this type of response also stimulate production of a population of memory cells. Again, subsequent exposure to the "real" organism in the field results in a faster and stronger cell-mediated response.