Diabetes can be contracted a variety of ways. In some cases it's autoimmune, in some cases it's literally dietary. In pregnancy even women without diabetes can contract gestational diabetes. If you have increased risk factors for diabetes, and perhaps you have too much fondness for the dessert buffet (all of us!); and if so, it's possible your gyno will want to test you for this condition before you even try to conceive to aid in having a healthy pregnancy. If you are pregnant and have these risk factors your gyno will probably screen you in pregnancy. If you have a blood sugar monitor and are on a diabetic diet, perhaps this step could be skipped and you can just be monitored very closely. If you are very low risk, some physicians will agree to omit the testing during pregnancy, but most birth providers recommend screening during pregnancy..
Risk factors are as follows from Up To Date.com:
A family history of diabetes, especially in first degree relatives
Prepregnancy weight ≥110 percent of ideal body weight or body mass index over 30 kg/m2 or significant weight gain in early adulthood and between pregnancies
Age greater than 25 years
Previous delivery of a baby greater than 9 pounds [4.1 kg]
Personal history of abnormal glucose tolerance
Member of an ethnic group with higher than the background rate of type 2 diabetes (in most populations, the background rate is approximately 2 percent).
Previous unexplained perinatal loss or birth of a malformed child
Maternal birth weight greater than 9 pounds [4.1 kg] or less than 6 pounds [2.7 kg]
Positive sugar test in the urine at the first prenatal visit
Polycystic ovary syndrome
Current use of glucocorticoids
Essential hypertension or pregnancy-related hypertension
Excessive weight gain in early to mid pregnancy, inactivity, and certain medications have also been associated with developing diabetes in pregnancy.