Background Tuberculosis (TB) presents a global threat in the world and the lung is the frequent site of metastatic focus. A previous study demonstrated that TB might increase primary lung cancer risk by two-fold for more than 20 years after the TB diagnosis. However, no large-scale study has evaluated the risk of TB and secondary lung cancer. Thus, we evaluated the risk of secondary lung cancer in patients with or without tuberculosis (TB) using a nationwide population-based dataset. Methods In a cohort study of 1,936,512 individuals, we selected 6934 patients among patients with primary cancer and TB infection, based on the International Classification of Disease (ICD-p-CM) codes 010-011 from 2000 to 2015. The control cohort comprised 13,868 randomly selected, propensity-matched patients (by age, gender, and index date) without TB exposure. Using this adjusted date, a possible association between TB and the risk of developing secondary lung cancer was estimated using a Cox proportional hazards regression model. Results During the follow-up period, secondary lung cancer was diagnosed in 761 (10.97%) patients with TB and 1263 (9.11%) patients without TB. After adjusting for covariates, the risk of secondary lung cancer was 1.67 times greater among primary cancer in the cohort with TB than in the cohort without TB. Stratification revealed that every comorbidity (including diabetes, hypertension, cirrhosis, congestive heart failure, cardiovascular accident, chronic kidney disease, chronic obstructive pulmonary disease) significantly increased the risk of secondary lung cancer when comparing the TB cohort with the non-TB cohort. Moreover, the primary cancer types (including head and neck, colorectal cancer, soft tissue sarcoma, breast, kidney, and thyroid cancer) had a more significant risk of becoming secondary lung cancer. Conclusion A significant association exists between TB and the subsequent risk for metastasis among primary cancers and comorbidities. Therefore, TB patients should be evaluated for the subsequent risk of secondary lung cancer.