ImportanceChanges in cervical length in twin pregnancies exhibit various patterns, but it is unclear whether the mechanism underlying spontaneous preterm birth (sPTB) is consistent. The existence of detailed phenomena in singleton pregnancies is also unclear.ObjectivesTo explore the different patterns in cervical length trajectories in singleton and twin pregnancies and to analyze whether the immunological mechanisms of sPTB are consistent among these cervical length patterns.Design, Setting, and ParticipantsThis cohort study recruited pregnant individuals who received antenatal care and delivered at Peking University Third Hospital in Beijing, China, between January 1, 2014, and December 31, 2022. Individuals with singleton and twin pregnancies were included.ExposuresCervical length measurements and white blood cell (WBC) indicators.Main Outcomes and MeasuresThe primary outcome was sPTB. Longitudinal trajectory cluster analysis was used to identify patterns of changes in cervical length in singleton and twin pregnancies. A random-effects model with cubic spline was used to fit and compare the longitudinal trajectory of WBC indicators among early preterm birth, moderate to late preterm birth, and term birth.ResultsA total of 43 559 pregnant individuals were included; of these, 41 706 had singleton pregnancies (mean [SD)] maternal age, 33.0 [4.0] years) and 1853 had twin pregnancies (mean [SD] maternal age, 33.3 [3.6] years). Two distinct patterns of cervical length changes were observed in both singleton and twin pregnancies: shortened (21 366 singletons and 546 twins) and stable (20 340 singletons and 1307 twins). In singleton pregnancies, WBC count was associated with early sPTB in individuals with both shortened cervix (odds ratio [OR], 1.35; 95% CI, 1.00-1.82) and stable cervix (OR, 1.64; 95% CI, 1.07-2.50). However, for twin pregnancies, the association of WBC count (OR, 3.13; 95% CI, 1.58-6.18) with the risk of early sPTB was observed only in individuals with a shortened cervix.Conclusions and RelevanceThis study identified 2 distinct cervical length patterns: shortened and stable. These patterns revealed 2 preterm birth mechanisms in twin pregnancies, with the immunopathogenesis of sPTB found only in the shortened cervix pattern; in singleton pregnancies, maternal immune response was associated with a higher risk of sPTB regardless of a shortened or stable cervix.