Chronic hepatitis B virus (HBV) infection is a prevalent public health issue worldwide. Its impact on important pregnancy outcomes, such as gestational diabetes mellitus (GDM), has not been clearly established. The findings from published studies are inconsistent. In this systematic review and meta-analysis, we aimed to clarify whether HBV infection manifested during pregnancy is associated with an increased risk of GDM. We searched MEDLINE and EMBASE for cohort studies and case-control studies that investigated the association between maternal hepatitis B surface antigen (HBsAg) positivity and GDM. We pooled adjusted odds ratio (aOR) and unadjusted OR, respectively, using the random-effect generic inverse variance method. We assessed risk of bias using the Quality in Prognosis Studies tool and conducted five pre-specified subgroup analyses. In total, 23 cohort studies involving 3 529 223 participants were included. The risk of GDM was 6.48% (1868/28 829) among HBsAg-positive pregnant women and 3.41% (119 283/3 500 394) among HBsAg-negative pregnant women. Meta-analyses of both unadjusted and adjusted effect estimates showed that HBsAg positivity during pregnancy was associated with higher risk of developing GDM (unadjusted OR 1.35, 95% CI: 1.17 to 1.56, I = 82.6%; adjusted OR 1.47, 1.22 to 1.76, I = 62%). Among pre-specified subgroup analysis, significant differences were found among studies with high vs low or moderate risk of bias. The results were robust to sensitivity analyses. In conclusion, HBsAg positivity during pregnancy has a moderate effect on an increased risk of GDM. Given the size of the population with HBV infection worldwide, however, this effect could have substantial impact on pregnancy. Further studies are warranted to investigate whether active infection with HBeAg positivity would further elevate the risk of adverse events during pregnancy.