Researchers analyzed data on almost 5.9 million people in 88 previous studies examining the connection between smoking, second-hand smoke exposure and diabetes. They estimated that roughly 28 million type 2 diabetes cases worldwide - or about 11.7 percent of cases in men and 2.4 percent in women - could be attributed to active smoking.
The more cigarettes smokers consumed, the more their odds of getting diabetes increased.
If they quit, ex-smokers initially faced an even higher risk of diabetes, but as more years pass without cigarette use their odds of getting the disease gradually diminished, the analysis found.
"The diabetes risk remains high in the recent quitters," said lead study author An Pan, of Huazhong University of Science and Technology in China. Weight gain linked to smoking cessation may be at least partly to blame for the heightened diabetes risk in those first months after giving up cigarettes, Pan added.
"However, the diabetes risk is reduced substantially after five years," Pan said by email. "The long-term benefits - including benefits for other diseases like cancer and heart disease - clearly outweigh the short-term higher risk."
Worldwide, nearly one in 10 adults had diabetes in 2014, and the disease will be the seventh leading cause of death by 2030, according to the World Health Organization.
Most of these people have type 2 diabetes, which is associated with obesity and aging and happens when the body can't properly use or make enough of the hormone insulin to convert blood sugar into energy. Left untreated, diabetes can lead to nerve damage, amputations, blindness, heart disease and strokes.
Plenty of research has established a connection between smoking and diabetes, although the reason is still unclear.
For the current analysis, Pan and colleges focused on exploring the link between the amount and type of smoke exposure and diabetes risk, as well as the potential for this risk to diminish with smoking cessation.
Overall, the pooled data from all the studies showed the risk of diabetes was 37 percent higher for smokers than non-smokers, the study team reports in The Lancet Diabetes and Endocrinology.
Exactly how smoking might lead to diabetes isn't firmly established, but it's possible smoking might cause inflammation, which in turn boosts the risk for diabetes, Dr. Abbas Dehghan, of Erasmus University Medical Center in Rotterdam, The Netherlands.
"The more one smokes, the more chronic inflammation there will be, and the higher the risk of diabetes will be," Dehghan, who wasn't involved in the study, said by email.
Occasional smokers were 21 percent more likely to have diabetes than people who never picked up the habit, while the increased risk was 57 percent for heavy smokers.
People exposed to second-hand smoke were 22 percent more likely to develop diabetes than people who never smoked, the study also found.
If smokers quit, their risk of diabetes over the next five years was 54 percent higher than for people who never smoked. After that, the increased risk dropped to 18 percent over the following five-year period. Remaining abstinent for a decade or more, however, reduced the extra risk to 11 percent.
While the connection between smoking and diabetes is nowhere near as strong as the link between cigarettes and lung cancer, the findings still suggest that doctors should add diabetes to the list of risks they warn smokers about, Amy Taylor of the University of Bristol in the U.K. and colleagues note in an accompanying editorial.
The short-term increase in diabetes risk after quitting shouldn't deter smokers' cessation efforts, they argue. Instead, smokers should remember that cigarettes are tied to lower weight and cessation can lead some people to eat or drink more, leading to weight gain.