The cause of diabetes is not from eating sugar. To begin, there are two different type of diabetes, which is type one and two. Type one diabetes occurs when a person is born with diabetes, so their body naturally does not make insulin. On the other hand, type two diabetes develops over a person's lifetime. An article by Diabetes Canada explains, "Type 2 diabetes is caused by several factors including obesity, ethnic background, a family history of type 2 diabetes and other environmental factors". So, there are other factors other than diet (in this case sugar) that will result in having type two diabetes.
https://www.diabetes.ca/about-diabetes/causes-of-diabetes