Background: Helicobacter pylori is an important pathogen in the upper digestive tract. It is of great significance to properly understand the risk factors for the transformation of Barrett esophagus into esophageal carcinoma. However, the relationship between H. pylori and gastroesophageal reflux disease (GERD) and Barrett esophagus remains controversial, and the correlation with immune function has been rarely reported. Objectives: This study investigated the effect of H. pylori infection on Barrett esophagus and its correlation with immune function. Methods: We recruited 40 patients with Barrett esophagus (Barrett esophagus group) and 40 patients with GERD (GERD group). In addition, 40 healthy controls were selected for the control group. Esophageal function and its correlation with immune function were measured in each group. Results: The positivity rate of H. pylori (P < 0.05) and sphincter pressure were lower in both Barrett esophagus and GERD groups than in the control group, while the levels of PGI, PGII, PGI/II, and G-17 were higher (P < 0.05). The levels of CD3+, CD4+, and CD4+/CD8+ were lower in the Barrett esophagus group than in the GERD group, but they were negatively correlated (P < 0.05) with H. pylori infection. The level of CD8+ was higher in the Barrett esophagus group, and it was positively correlated (P < 0.05) with H. pylori infection. Conclusions: Helicobacter pylori infection may protect against Barrett esophagus by reducing gastric acid secretion and increasing lower esophageal sphincter pressure. Besides, it has a certain correlation with immune function.