Abstract Background Literature suggests that nonobstetric surgery during gestation is associated with a higher risk of spontaneous abortion, prematurity, and a higher cesarean section rate, but the direct impact on fetal outcomes is still unclear. In this study, we aimed to investigate whether nonobstetric surgery during pregnancy is associated with negative fetal outcomes by analysing a nation-wide database in Taiwan. Methods This population-based retrospective observational case–control study was based on the linkage of Taiwan’s National Health Insurance Research Database, Birth Reporting Database, and Maternal and Child Health Database between 2004 and 2014. For every pregnancy with nonobstetric surgery during gestation, four controls were randomly matched according to maternal age and delivery year. We estimated adjusted odds ratios (aOR) and 95% confidence intervals (CIs) of adverse fetal outcomes with the non-surgery group as the reference. The primary outcomes involved stillbirth, prematurity, low birth weight, low Apgar scores, and neonatal and infant death. Results Among 23,721 identified pregnancies, 4,747 underwent nonobstetric surgery. Pregnancies with nonobstetric surgery had significantly higher risks of prematurity (aOR: 1.46; 95% CI: 1.31–1.62), lower birth weight (aOR: 1.49; 95% CI: 1.33–1.67), Apgar scores