Few therapeutic methods exist for preventing preterm birth (PTB), or delivery before completing 37 weeks of gestation. In the US, progesterone (P4) supplementation is the only FDA-approved drug for use in preventing recurrent spontaneous PTB. However, P4 has limited effectiveness, working in only approximately one-third of cases. Computational drug repositioning leverages data on existing drugs to discover novel therapeutic uses. We used a rank-based pattern-matching strategy to compare the differential gene expression signature for PTB to differential gene expression drug profiles in the Connectivity Map database and assigned a reversal score to each PTB-drug pair. Eighty-three drugs, including P4, had significantly reversed differential gene expression compared with that found for PTB. Many of these compounds have been evaluated in the context of pregnancy, with 13 belonging to pregnancy category A or B - indicating no known risk in human pregnancy. We focused our validation efforts on lansoprazole, a proton-pump inhibitor, which has a strong reversal score and a good safety profile. We tested lansoprazole in an animal inflammation model using LPS, which showed a significant increase in fetal viability compared with LPS treatment alone. These promising results demonstrate the effectiveness of the computational drug repositioning pipeline to identify compounds that could be effective in preventing PTB.