The objective of this retrospective cohort study was to investigate the correlation between serum 25-OH-VitD levels, coagulation function, immune factors, and the risk of spontaneous abortion in the first trimester of pregnancy. Additionally, independent risk factors for spontaneous abortion in the first trimester of pregnancy were identified. A total of 412 pregnant women who attended Hubei Maternal and Child Health Care Hospital between October 2021 and February 2022 were included in the study. Of these, 221 met the eligibility criteria and were categorized into the early spontaneous abortion case group (n = 107) or the normal pregnancy control group (n = 114). The serum levels of 25-OH-VitD, CD3 + CD19- T lymphocytes, CD3-CD19 + B lymphocytes, NK (Natural Killer) cells, TNF-α (tumor necrosis factor-α) and coagulation factors (D-dimer, Protein C, Protein S) in both these groups were measured during early pregnancy (within 12 weeks) and evaluated using logistic regression analysis. Compared to the control group, body mass index, Protein S, CD19 + CD3-B lymphocytes, and 25-OH-VitD were significantly lower in the spontaneous abortion group during early pregnancy (P = .001; P = .004; P = .009; P = .001), blood glucose (fasting) and TNF-α significantly increased (P = .001; P = .046). Logistic regression analysis of potential mixed factors showed that fasting blood glucose and TNF-α were significantly different from the control group and were positively correlated (P = .001, P = .038). Fasting blood glucose 0R value is 2.264, 95% confidence interval is 0.043~0.25, TNF-α 0R value is 0.126, 95% confidence interval is 0.800~0.972. CD19 + CD3-B cells and 25-OH-VitD were correlated with spontaneous abortion (P = .005; P = .001), respectively 0R value and 95% confidence interval being −0.007 (1.002~1.012), −0.179 (1.139~1.256). Risk factors for spontaneous abortion in the first trimester (<12 weeks) of pregnancy include fasting glucose tolerance, decreased CD19 + CD3-energy B lymphocytes and 25-OH-VitD, and abnormal increase of TNF-α. Therefore, it is recommended that women with fertility needs be examined as early as possible to avoid adverse outcomes.