Besides being overweight which is the most common reason, there's a lot of other reasons that may cause diabetes type 2. Another thing is age, the older you get, the chance are bigger you can get diabetes.
I know it's already written, but I'll write it again, if you want to prevent it you should, of course, pay attention to nutrition and your eating habits in general. You can read more in the article below.
https://www.hsph.harvard.