The study of the immune response to infectious diseases, including viral, bacterial, and parasitic infections.