Around half of the world's population is infected with Helicobacter pylori (H. pylori), which is closely related to several ocular diseases. The study aims to evaluate the retinal and choroidal thickness changes in subjects with H. pylori infection by swept-source optical coherence tomography (SS-OCT). The ophthalmic examination and 13C-urea breath test (13C-UBT) were performed on all subjects participating in the cross-sectional study. The participants were divided into H. pylori (+) and H. pylori (-) groups depending on the 13C-UBT results. This study covered 2574 right eyes from 2574 subjects with H. pylori infection and 2574 right eyes from 2574 age- and sex-matched individuals without H. pylori infection. Out of the nine sectors of the early treatment diabetic retinopathy study (ETDRS) grid, the maximum retinal thickness was in the inner superior sector, while the minimum was in the center sector. The maximum choroidal thickness was in the inner superior sector, while the minimum was in the outer nasal sector. The choroid of each area of the ETDRS subfield in the H. pylori (+) group was significantly thicker than that in the H. pylori (-) group, but retinal thickness did not show any difference between the two groups. Increased choroidal thickness may be an early indicator of H. pylori-associated retinal or choroidal diseases.