Aim To screen specific biomarkers which early diagnose the risk of threatened preterm birth (TPB) and preterm birth (PB) to improve the pregnancy outcome and analyze its underlying mechanisms. Methods Three groups of vaginal secretions samples, including full-term birth (FB), TPB, and PB were collected to clarify the relationship between metabolites and health status of pregnant women. Results Here, screened out two species (Prevotella melaninogenica and Serratia marcescens) and five genera (Stenotrophomonas, Caulobacter, Sphingomonas, Asticcacaulis, and Sneathia) to be differentially distributed among three groups. There were 30 significantly different metabolites in three groups, and nine metabolites (pos_3691, pos_2441, pos_2629, pos_1152, pos_615, pos_1229, pos_2110, pos_1357, and pos_1737) to be screened as potential metabolic markers in three groups. Five metabolites, including pos_3691, pos_2441, pos_1343, pos_1647, and pos_3239 could be used as a metabolic marker for early diagnosis of TPB. And the significantly enriched pathway was phenylalanine, tyrosine, and tryptophan biosynthesis. Conclusion This study clarifies vaginal flora and metabolites to be associated with TPB and PB, two species and five genera of vaginal bacteria, nine metabolites may be the potential biomarker in distinguishing different health states of pregnant women, to early diagnose the risk of TPB and PB and improve the pregnancy outcome.