This study aimed to evaluate the systemic impact of periodontitis, previously considered a local disease, on cancer occurrence. We enrolled 683,854 participants, comparing cancer incidence among those with and without periodontitis and assessing the impact of periodontal treatment on cancer risk. Regardless of gender, age, Charlson comorbidity index, or the use of non-steroidal anti-inflammatory drugs, periodontitis patients had a lower overall cancer risk than controls. However, men with periodontitis had a higher risk of prostate cancer (adjusted hazard ratio [aHR] = 1.22; 95% confidence interval [CI] = 1.10–1.35), and both men and women had a higher risk of thyroid cancer (women: aHR = 1.20, 95%CI = 1.04–1.38; men: aHR = 1.51, 95% CI = 1.15–1.99). Patients with periodontitis who received treatment showed a reduced cancer risk (aHR = 0.41; 95% CI = 0.38–0.44) compared to untreated patients. Proper treatment for periodontitis may lower an individual’s cancer risk more than if they did not have the disease at all, suggesting that periodontitis is a modifiable risk factor for cancer.