Gestational diabetes mellitus (GDM) is a common metabolic disorder in pregnancy, but the underlying mechanism has not been fully clarified. Using metabolomic profiling of second-trimester saliva, serum, and urine, we identify 54 metabolites altered in GDM that converge on key metabolic pathways. Fifty GDM biomarkers independently associated with abnormal maternal glucose and insulin resistance are selected to construct GDM discriminant models (internal test AUC: 0.868; real-world test: 0.796). These GDM biomarkers are also associated with clinical profiles and adverse outcomes, thereby predicting maternal and neonatal risks (internal test AUC: 0.764 and 0.838; real-world test: 0.726 and 0.792, respectively). Eleven GDM biomarkers are already altered in the first trimester, which can be used for the early prediction of GDM (internal test AUC: 0.767; real-world test: 0.744). In this work, changes and interactions of metabolites in saliva, serum, and urine in the second trimester are first identified in GDM, providing insights into its pathogenesis and potential early prediction and prevention strategies.