Diabetes screening is recommended for many people at various stages of life, and for those with any of several risk factors. The screening test varies according to circumstances and local policy, and may be a random blood glucose test, a fasting blood glucose test, a blood glucose test two hours after 75 g of glucose, or an even more formal glucose tolerance test. Many healthcare providers recommend universal screening for adults at age 40 or 50, and often periodically thereafter. Earlier screening is typically recommended for those with risk factors such as obesity, family history of diabetes, high-risk ethnicity (Mestizo/Hispanic, Native American, Afro-Caribbean, Pacific Island, and South Asian ancestry).

Many medical conditions are associated with diabetes and warrant screening. A partial list includes: high blood pressure, elevated cholesterol levels, coronary artery disease, past gestational diabetes, polycystic ovary syndrome, chronic pancreatitis, fatty liver, hemochromatosis, cystic fibrosis, several mitochondrial neuropathies and myopathies, myotonic dystrophy, Friedreich's ataxia, some of the inherited forms of neonatal hyperinsulinism. The risk of diabetes is higher with chronic use of several medications, including high-dose glucocorticoids, some chemotherapy agents (especially L-asparaginase), as well as some of the antipsychotics and mood stabilizers (especially phenothiazines and some atypical antipsychotics).

Type 1 diabetes risk is known to depend upon a genetic predisposition based on HLA types (particularly types DR3 and DR4), an unknown environmental trigger (suspected to an infection in most cases), and an uncontrolled autoimmune response that attacks the insulin producing beta cells. Some research has suggested that breastfeeding decreased the risk; various other nutritional risk factors are being studied, but no firm evidence has been found.

Type 2 diabetes risk can be reduced in many cases by making changes in diet and increasing physical activity. The American Diabetes Association (ADA) recommends maintaining a healthy weight, getting at least 2½ hours of exercise per week (a brisk sustained walk appears sufficient), having a modest fat intake, and eating a good amount of fiber and whole grains. The ADA does not recommend alcohol consumption as a preventative, but it is interesting to note that moderate alcohol intake may reduce the risk (though heavy consumption clearly increases damage to body systems significantly). There is inadequate evidence that eating foods of low glycemic index is clinically helpful.

Some studies have shown delayed progression to diabetes in predisposed patients through prophylactic use of metformin, rosiglitazone, or valsartan. In patients on hydroxychloroquine for rheumatoid arthritis, incidence of diabetes was reduced by 77%. Breastfeeding might also be correlated with the prevention of type 2 of the disease in mothers.