Most likely the immune system was put into place in the original human body design. We know from Exodus 20:11 and other verses that God completed His work of creation in six days. Therefore, the human body and its functional parts, including the components of the immune system, must have been part of the original creation. God said that all He had made was very good (Genesis 1:31). Since there were no pathogens (germs), parasites, or diseases prior the Edenic Fall and subsequent Curse, the immune system may have functioned differently in that world unmarred by sin and death.
The immune system serves more than just to “defend” against disease. The immune system was designed to interact with microbes and cleanse the body of aged, dying, dead red blood cells and bacteria even in the Pre-Fall World. There are toll-like receptors in the immune system that have “sensory” function, as well as defense functions in animals and humans. The immune system in Peyer’s Patches in the GI tract assists the normal development of the intestine and regulates the normal microbiome. Consider a sheep dog designed to positively interact with sheep (herd them); they only “defend” with teeth when a predator (e.g. a wolf) approaches. The immune system in a pre-Fall world (Gillen and Sherwin 2013) worked to positively assist body development (as will be discussed); in the post-Fall world, they also defend against pathogens. This is how most creation biologists view the immune system.
Immunology is that branch of biology that involves studying how the body is designed to protect itself from agents of disease called pathogens. The word immune comes from the Latin root word that means “freedom or protection from taxes or burdens.” This amazing system battles disease in a manner that is so complex and intricate that the most gifted imagination could not envision such incredible functions. In today’s world (post-Fall), the primary role of our immune system is to recognize pathogens and parasites, then to destroy them. Three main methods of destruction include baths of caustic digestive enzymes that cause rapid perforation with submicroscopic holes, overwhelming organisms with sticky proteins, and lastly by ingestion by macrophages (amoeba-like cells). In addition, the immune system is designed to prevent the proliferation of mutant cells, such as various cancers. When this system malfunctions or when a boundary is breached, it can result in localized or systemic infections, or worse, death.
Gillen, Alan L. and Conrad, Jason, "Our Impressive Immune System: More Than a Defense" (2014). Faculty Publications and Presentations. 135.