Orange stars

Pneumonia in People With a Weakened Immune System

Full Review: Sept 2026 BySanjay Sethi, MD, University at Buffalo, Jacobs School of Medicine and Biomedical Sciences
Last updated: Sept 2026
v724684
VIEW PROFESSIONAL VERSION

Pneumonia is infection of the lungs. Pneumonia in people whose immune system is weakened or impaired (for example, by human immunodeficiency virus [HIV], cancer, organ transplantation, or the use of certain medications) is often caused by different organisms than those that cause pneumonia in healthy people.

  • Pneumonias due to microorganisms that do not often cause disease in healthy people can occur in people who have a weakened immune system.

  • Symptoms vary but may include shortness of breath, cough, and fever.

  • X-rays of the chest are often combined with examinations of sputum and blood samples to make the diagnosis.

  • Antibiotic, antifungal, or antiviral medications are used to treat this pneumonia, and any underlying immune system problem is treated.

People who have a weakened or impaired immune system are described as being immunocompromised. The immune system defends the body against microorganisms that can cause infection.

In people with a weakened immune system, pneumonia may be caused by many microorganisms, including those that do not usually cause pneumonia (see also Overview of Pneumonia). Many conditions may cause weakness of the immune system, including:

  • Defects in white blood cells

  • Diseases, such as HIV infection

  • Certain medications (such as steroids [sometimes called glucocorticoids or corticosteroids], chemotherapy agents, and medications used to treat autoimmune or systemic rheumatic diseases)

Causes of Pneumonia in People With a Weakened Immune System

In people with a weakened immune system, pneumonia may be caused by the same microorganisms that cause community-acquired pneumonia but also can be caused by unusual or uncommon organisms.

Pneumocystis jirovecii is a common fungus that may reside harmlessly in the lungs of healthy people. It usually causes pneumonia only when the body’s defenses are weakened because of human immunodeficiency virus (HIV) infection, organ transplantation, cancer, or use of medications that alter the immune system. Often, P. jirovecii pneumonia is the first indication HIV infection has become severe.

Other fungi such as Aspergillus and Candida, bacteria such as Staphylococcus aureus, Streptococcus pneumoniae, and Haemophilus influenzae, and viruses such as cytomegalovirus and herpes simplex virus also cause pneumonia in people with a weakened immune system. Sometimes a person may have an infection caused by more than one organism.

Symptoms of Pneumonia in People With a Weakened Immune System

Symptoms of pneumonia in people who have a weakened immune system may be the same as those for community-acquired pneumonia and include the following:

  • A general feeling of weakness (malaise)

  • Cough that produces sputum (thick or discolored mucus)

  • Shortness of breath

  • Fever

  • Chills

  • Chest pain

These symptoms can develop rapidly or slowly.

Most people who have P. jirovecii pneumonia develop a fever, shortness of breath, and a dry cough, often slowly. The lungs may not be able to deliver sufficient oxygen to the blood, leading to shortness of breath that is sometimes severe.

Diagnosis of Pneumonia in People With a Weakened Immune System

  • Chest x-ray

  • Microscopic examination of a sputum (thick or discolored mucus) sample

  • Blood cultures

  • Pulse oximetry

The diagnosis of pneumonia in a person who has a weakened immune system is based on the person’s symptoms, the underlying immune system problem, the results of a chest x-ray or computed tomography (CT) scan, and the results of sputum and blood tests.

Chest x-rays may be normal or may show signs of infection. CT scans are sometimes required to confirm the pneumonia.

Doctors obtain sputum samples by giving a vapor treatment that causes the person to cough deeply (inducing sputum production) or insert a bronchoscope (small flexible tube equipped with a camera) into the airways. Sputum samples may be obtained by inducing a cough or with a bronchoscope to allow doctors to identify the organism causing pneumonia.

Doctors usually take a sample of blood so they can try to grow (culture) the bacteria or other organisms in the laboratory and identify it. More specialized molecular tests such as polymerase chain reactions (PCR) are available to identify the organism causing pneumonia.

The specific underlying cause of the immune system problem is also sought (eg, HIV infection, including advanced HIV, low levels of certain white blood cells, genetic defects).

Various types of organisms can cause pneumonia in these individuals. Therefore, doctors perform more tests to identify the organism, such as bronchoscopy or even a lung biopsy.

Treatment of Pneumonia in People With a Weakened Immune System

  • Antibiotics, antivirals, or antifungals

  • Treatment of any immune system problem

Treatment of pneumonia depends on the:

  • Specific immune system problem

  • Severity of illness

  • Organisms that may be causing infection

Doctors usually give an antibiotic that is effective against many organisms (a broad-spectrum antibiotic). If the person's condition does not improve, doctors may add an additional medication that is effective against viruses or fungi.

Therapies to improve the immune system are also important for the treatment of pneumonia in people with immune system problems. Medications that suppress the immune system (such as chemotherapy drugs or medications used to treat autoimmune disorders) may be temporarily stopped until the infection has resolved.

People who have P. jirovecii pneumonia are given the combination antibiotic sulfamethoxazole/trimethoprim. Alternative medications are dapsone, atovaquone, clindamycin, and pentamidine. Some people with severe pneumonia due to P. jirovecii are also given the steroid prednisone to reduce inflammation.

Prognosis for Pneumonia in People With a Weakened Immune System

Even when the pneumonia is treated, the overall death rate is higher than that for generally healthy people with community-acquired pneumonia because infections are much harder to treat in people with immune system problems and because these people tend to be much sicker, even before pneumonia begins.

Prevention of Pneumonia in People With a Weakened Immune System

Doctors often give treatments to help bolster the person's immune system and prevent pneumonia. For example, in people whose immune system has been weakened by cancer treatment, doctors may give a medication called granulocyte-colony stimulating factor to enhance the production of white blood cells (the type that fight infection). In people with HIV infection, antiretroviral treatment decreases the risk of pneumonia with P. jirovecii.

People who are at risk of pneumonia caused by bacteria should receive vaccinations against pneumococcus and Haemophilus influenzae.

The combination antibiotic sulfamethoxazole/trimethoprim can be used to help prevent P. jirovecii pneumonia in people at risk. The side effects of this medication include rashes, a reduced number of infection-fighting white blood cells, and fever. Side effects are particularly common among people with severe HIV infection. Alternative preventive medications are dapsone or pentamidine.

Drug Information for the Topic

quizzes_lightbulb_red
Test your KnowledgeTake a Quiz!
iOS ANDROID
iOS ANDROID
iOS ANDROID