One of the main goals of cosmology is to search for the imprint of primordial gravitational waves in the polarisation filed of the cosmic microwave background to probe inflation theories. One of the obstacles in detecting the primordial signal is that the cosmic microwave background B-mode polarisation must be extracted from among astrophysical contaminations. Most efforts have focus on limiting Galactic foreground residuals, but extragalactic foregrounds cannot be ignored at the large scale (ℓ ≲ 150), where the primordial B-modes are the brightest. We present a complete analysis of extragalactic foreground contamination that is due to polarised emission of radio and dusty star-forming galaxies. We update or use current models that are validated using the most recent measurements of source number counts, shot noise, and cosmic infrared background power spectra. We predict the flux limit (confusion noise) for future cosmic microwave background (CMB) space-based or balloon-borne experiments (IDS, PIPER, SPIDER, LiteBIRD, and PICO), as well as ground-based experiments (C-BASS, NEXT-BASS, QUIJOTE, AdvACTPOL, BICEP3+Keck, BICEPArray, CLASS, Simons Observatory, SPT3G, and S4). The telescope aperture size (and frequency) is the main characteristic that affects the level of confusion noise. Using the flux limits and assuming mean polarisation fractions independent of flux and frequency for radio and dusty galaxies, we computed the B-mode power spectra of the three extragalactic foregrounds (radio source shot noise, dusty galaxy shot noise, and clustering). We discuss their relative levels and compare their amplitudes to that of the primordial tensor modes parametrised by the tensor-to-scalar ratio r. At the reionisation bump (ℓ = 5), contamination by extragalactic foregrounds is negligible. While the contamination is much lower than the targeted sensitivity on r for large-aperture telescopes at the recombination peak (ℓ = 80), it is at a comparable level for some of the medium- (∼1.5 m) and small-aperture telescope (≤0.6 m) experiments. For example, the contamination is at the level of the 68% confidence level uncertainty on the primordial r for the LiteBIRD and PICO space-based experiments. These results were obtained in the absence of multi-frequency component separation (i.e. considering each frequency independently). We stress that extragalactic foreground contaminations have to be included in the input sky models of component separation methods dedicated to the recovery of the CMB primordial B-mode power spectrum. Finally, we also provide some useful unit conversion factors and give some predictions for the SPICA B-BOP experiment, which is dedicated to Galactic and extragalactic polarisation studies. We show that SPICA B-BOP will be limited at 200 and 350 μm by confusion from extragalactic sources for long integrations in polarisation, but very short integrations in intensity.