Introduction: Stroke is closely related to cognitive function, and many patients experience cognitive impairment after stroke; however, whether cognitive impairment is associated with an increased risk of stroke remains inconclusive. This study aims to investigate whether cognitive impairment is associated with new-onset stroke (first ever nonfatal stroke) using a national prospective study. Methods: Data from the China Health and Retirement Longitudinal Study (CHARLS) from 2011 to 2018 were used. A total of 11,961 Chinese participants aged ≥45 years without a history of stroke were included in the present study and divided into a cognitive impairment group and a normal group according to the baseline cognitive score. Logistic regression analysis was used to analyse the association between baseline cognitive function and new-onset stroke. Results: During the 6.96-year follow-up period, 875 participants experienced new-onset stroke. Compared with the cognitively normal group, the odds ratio (95% confidence intervals) for new-onset stroke in the cognitively impaired group was 1.21 (1.04, 1.40) when not adjusted for confounders and 1.22 (1.01, 1.48) after adjusting for established confounding factors, including demographic data, medical history, physical examination, and laboratory indicators. Conclusion: Cognitive impairment was associated with new-onset stroke among middle-aged and elderly Chinese individuals. Further studies should be carried out to confirm the causal relationship between cognitive impairment and stroke.