Background: Gestational Diabetes Mellitus (GDM) is one of the complications of pregnancy that significantly contributes to maternal and infant morbidity and mortality rates. Although the prevalence of GDM is relatively low in Indonesia, the actual number may be higher due to underdiagnosis. There are limited previous studies on knowledge and preventive practices related to Gestational Diabetes Mellitus, particularly in Indonesia. Objective: To analyze the relationship between knowledge and preventive behavior of Gestational Diabetes Mellitus among pregnant women. Methods: A quantitative research study with a cross-sectional design involving 83 pregnant women in Bogor, West Java, Indonesia, selected through accidental sampling. The inclusion criteria were pregnant women in their first to third trimesters, while the exclusion criteria were those who had mental disorders. Data were collected using a questionnaire developed by Nanyangwe Siuluta, consisting of 31 items on knowledge and 5 items on preventive practices of Gestational Diabetes Mellitus. The multivariate Logistic regression was performed to analyze the data. Results: The findings showed that 51.8% of pregnant women had good knowledge, and 54.2% had poor preventive behaviors. There is a significant relationship between age (p = 0.019), family history of diabetes (p = 0.021), knowledge (p < 0.001), and preventive practices of Gestational Diabetes Mellitus. Multivariate analysis showed that knowledge (p < 0.001) is a significant factor related to preventive practice after controlling for age (p = 0.169) and family history of diabetes (p = 0.428). Conclusion: These findings highlight the importance of educational interventions to enhance the knowledge of pregnant women to promote good prevention behavior.