This study aims to determine whether postpartum body mass index (BMI) trajectories and its time in target range (TTR) are associated with long-term type 2 diabetes risk in women with a history of gestational diabetes mellitus (GDM). The present study included 1057 women with a history of GDM who participated in the Tianjin Gestational Diabetes Mellitus Prevention Program (TGDMPP). Oral glucose tolerance tests or physician-diagnosed information were used to diagnose type 2 diabetes after a median follow-up period of 8.47 years. Latent class modelling was applied to identify trajectories of BMI after delivery. TTR was defined as the proportion of time that BMI was within the standard range (18.5 ≤ BMI < 24.0 kg/m2). The associations of BMI trajectories and TTR with type 2 diabetes risk were analysed using multivariable Cox modelling. Five distinct trajectories of postpartum BMI were identified. Compared with low-stable class, the multivariable-adjusted hazard ratios of type 2 diabetes were 2.02 (95% confidence interval 0.99-4.10) for median-stable class, 3.01 (1.17-7.73) for high-stable class, 2.15 (0.63-7.38) for U-shape class and 7.15 (2.08-24.5) for inverse U-shape class (p for trend = 0.012), respectively. Multivariable-adjusted hazard ratios of type 2 diabetes associated with postpartum BMI TTR of 100%, >43.4%-<100%, >0%-≤43.4% and 0% were 1.00, 1.84 (0.72-4.73), 2.75 (1.23-6.15) and 2.31 (1.05-5.08) (p for trend = 0.039), respectively. Postpartum BMI trajectories of high-stable and inverse U-shape class as well as lower TTR were associated with an increased risk of type 2 diabetes among women with a history of GDM. Reducing BMI to a normal range in the early postpartum period and maintaining stable over time could attenuate the development of long-term type 2 diabetes.