Proper immune function is dependant on calorie intake, adequate macronutrients intake and adequate micro-nutrients intake. Not consuming enough calories contributes to lower energy levels and decrease immunity against viruses, diseases and infections. Undernutrition can make one more prone to infections and vice versa, infection can contribute to malnutrition (e.g. through loss of appetite or inability to prepare a balanced meal due to energy loss). These two factors are interrelated. The deficiency of certain microelements, such as vitamin C can cause diseases (such as curvy for instance) and decreased immune response, which makes the human body an easier target for viruses. It can also impact the rate of wound healing and fighting off the infections, which means that once undernourished, one will recover significantly longer.
Undernutrition of both micro and macronutrients will have an impact on the human body and lack of appropriate amount of calories or micronutrients in the diet will cause loss of energy. If the problem persists for a longer period of time overall health and immune response get compromised as the immune system does not have the energy to fight off the infections and produce enough anti-bodies. Undernutrition can cause a decrease in leukocytes (white blood cells) production. Leukocytes are important cells of the immune system that are involved in guarding the body against diseases and other invaders. People suffering from AIDS have their immune system weakened due to the human immunodeficiency virus and it causes them to suffer greatly from potentially harmless infections that would only cause common cold or flu under normal circumstances. The situation is pretty similar when the immune system is weakened due to lack of energy or specific micronutrients that are necessary for its proper functioning.
By not eating enough calories, enough macroelements (such as protein for instance, which also supports the immune system and its inadequate intake might compromise immune response) the body will not be provided with fuels that are necessary for maintaining health, fighting off viruses and bacterial infections, wound healing and general health.