Background As the number of cancer survivors increases, the prevalence of the second type of primary cancer will increase. In clinical trials, patients with a history of malignant tumors in the past are usually excluded. It is unknown whether previous cancers affect survival outcomes. The purpose of this study was to investigate the impact of previous malignant tumors on the long-term prognosis of patients with gallbladder cancer. Methods By using the Surveillance, Epidemiology and END Results (SEER) database, we collect patient data and obtain patients who had gallbladder cancer diagnosed in 2004–2015 and had an adaption and contrast 1:1 with cases. We applied the Kaplan–Meier analysis and Cox regression models to assess the influence of prior malignancy on gallbladder cancer survival outcomes. Results Among 8338 patients who had mainly gallbladder cancer, 525 (6.3%) suffered prior cancer. Prostate cancer (22.29%), Breast cancer (21.14%), and Genitourinary (14.67%) are the most common types. Before propensity score matching (PSM), two groups of different Kaplan–Meier curves were obtained by classifying previous cancer history, and by comparison, the all-cause difference in the group with previous cancer history was not salience ( P = 0.31), but there is a protective effect on the Cancer-specific fatality rate ( p < 0.001). Similar results were obtained after propensity score matching (PSM). Among the multivariate Cox analysis, previous malignancy had no obvious relation, including all causes (HR = 0.98, 95% CI: 0.86–1.12, p = 0.70) but a better gallbladder cancer-specific survival (HR =0.64, 95% CI: 0.55–0.75, P < 0.001). Conclusion Prior cancer may not be an obvious factor impacting the survival of cancers of all-cause including the gallbladder. In clinical trials of gallbladder cancer, exclusion criteria based on cancer history should be assessed.