This study evaluates the relationship between single nucleotide polymorphisms (SNPs) in nonsteroidal anti-inflammatory drug (NSAID) metabolism and related pathways and spontaneous abortion (SAB, gestation < 20 weeks) risk. Women were enrolled in Right from the Start (2004-2010) prospective cohort. Periconceptional NSAIDs reported through the sixth week of pregnancy were obtained from study interviews. We evaluated 201 SNPs in 600 European American women. Interaction analyses between NSAID use and SNPs were conducted using logistic regression, adjusted for confounders. We also evaluated prostaglandin E2 urinary metabolite (PGE-M) in an independent population for association with SNPs using linear regression. NSAID use was reported by 63% of cases and 62% controls. The most significant interaction was at prostacyclin synthase (PGIS) rs5602 (OR = 0.34, 95% CI 0.19-0.60, p = 2.45 × 10) and was significant after a Bonferroni correction. NSAID users were protected from SAB (OR = 0.78, 95% CI 0.56-1.10), while non-NSAID users were at increased risk (OR = 2.11, 95% CI 1.35-3.29) in rs5602 stratified analyses. rs5602 also associated with increased PGE-M levels (Beta = 0.09, 95% CI -0.002-0.19, p = 0.033). We identified an association between a PGIS variant and SAB risk that is modified by NSAIDs use during pregnancy and directly associated with increased levels of PGE metabolites. This suggests the potential use of genetic information to guide pharmaceutical intervention to prevent adverse pregnancy outcomes.