Major emergency abdominal surgery is associated with postoperative complications and high mortality. Long-term outcomes in patients with perioperative atrial fibrillation (POAF) have recently received increased attention, especially POAF in non-thoracic surgery. This study aimed to compare long-term AF related hospitalization and stroke in patients with POAF in relation to major emergency abdominal surgery and in patients with non-perioperative AF. We crosslinked data from Danish nationwide registries and identified all patients who underwent major emergency abdominal surgery (2000-2018) and were diagnosed with POAF, and patients who developed AF in a non-perioperative setting. Patients with POAF were matched in a 1:5 ratio on age, sex, year of AF diagnosis and oral anticoagulation (OAC) status at the beginning of follow-up with patients with non-perioperative AF. From discharge, we examined adjusted hazard ratios (HR) of stroke using multivariable Cox regression analysis. The study population comprised 1,041 (out of 42,021 who underwent major emergency abdominal surgery) patients with POAF and 5,205 patients with non-perioperative AF. The median age was 78 years [interquartile range: 71-84] for those initiated on OAC therapy and 78 years [interquartile range: 71-85] for those not initiated on OAC therapy. During the first year of follow up, POAF was associated with similar rates of stroke as non-perioperative AF (patients initiated on OAC: HR 0.96 (95% confidence interval (CI) 0.52-1.77) and patients not initiated on OAC: HR 0.69 (95% CI 0.41-1.15). POAF in relation to major emergency abdominal surgery was associated with similar rates of stroke as non-perioperative AF. These results suggest that POAF not only carry an acute burden but also a long-term burden in patients undergoing major emergency abdominal surgery.