Sometimes diabetes is a disease that happens to you because of unlucky genetics (or simply a family history). Other times it is a disease that you find. Risk factors for developing diabetes includes obesity, older age, and physical inactivity. Gestational diabetes (i.e. that occurring during pregnancy) is an entirely different conversation.
The CDC-led National Diabetes Prevention Program https://www.cdc.gov/diabetes/prevention/index.html
can help you can help you make healthy changes that have lasting results.