Despite mounting evidence of the positive relationship between diabetes mellitus (DM) and heart failure (HF), the entire context of the magnitude of risk for HF in relation to DM remains insufficiently understood. The principal reason is because new‐onset HF (HF occurring in participants without a history of HF) and recurrent HF (HF re‐occurring in patients with a history of HF) are not discriminated. This meta‐analysis aims to comprehensively and separately assess the risk of new‐onset and recurrent HF depending on the presence or absence of DM. We systematically searched cohort studies that examined the relationship between DM and new‐onset or recurrent HF using EMBASE and MEDLINE (from 1 Jan 1950 to 28 Jul 2019). The risk ratio (RR) for HF in individuals with DM compared with those without DM was pooled with a random‐effects model. Seventy‐four and 38 eligible studies presented data on RRs for new‐onset and recurrent HF, respectively. For new‐onset HF, the pooled RR [95% confidence interval (CI)] of 69 studies that examined HF as a whole [i.e. combining HF with preserved ejection fraction (HFpEF) and HF with reduced ejection fraction (HFrEF)] was 2.14 (1.96–2.34). The large between‐study heterogeneity (I 2 = 99.7%, P < 0.001) was significantly explained by mean age [pooled RR (95% CI) 2.60 (2.38–2.84) for mean age < 60 years vs. pooled RR (95% CI) 1.95 (1.79–2.13) for mean age ≥ 60 years] (P < 0.001). Pooled RRs (95% CI) of seven and eight studies, respectively, that separately examined HFpEF and HFrEF risk were 2.22 (2.02–2.43) for HFpEF and 2.73 (2.71–2.75) for HFrEF. The risk magnitudes between HFpEF and HFrEF were not significantly different in studies that examined both HFpEF and HFrEF risks (P = 0.86). For recurrent HF, pooled RR (95% CI) of the 38 studies was 1.39 (1.33–1.45). The large between‐study heterogeneity (I 2 = 80.1%, P < 0.001) was significantly explained by the proportion of men [pooled RR (95% CI) 1.53 (1.40–1.68) for < 65% men vs. 1.32 (1.25–1.39) for ≥65% men (P = 0.01)] or the large pooled RR for studies of only participants with HFpEF [pooled RR (95% CI), 1.73 (1.32–2.26) (P = 0.002)]. Results indicate that DM is a significant risk factor for both new‐onset and recurrent HF. It is suggested that the risk magnitude is large for new‐onset HF especially in young populations and for recurrent HF especially in women or individuals with HFpEF. DM is associated with future HFpEF and HFrEF to the same extent.