A bacterial, viral or fungal infection in tissues of the esophagus may cause esophagitis . Infectious esophagitis is relatively rare and occurs most often in people with poor immune system function, such as people with HIV/AIDS or cancer.