Context. Radio observations at low frequencies are sensitive to the magnetic activity of stars and the plasma environment surrounding them, so one can scrutinize the conditions under which stellar space weather develops and impacts exoplanets. The accurate interpretation of the processes underlying the radio signatures requires a detailed characterisation of stellar magnetism. Aims. We study two M dwarfs, namely StKM 1-1262 (M0 type, Prot = 1.24 d) and V374 Peg (M4 type, Prot = 0.4455 d), which were detected recently with the LOw Frequency ARray (LOFAR). StKM 1-1262 exhibited the typical signature of a type-II radio burst, potentially resulting from a coronal mass ejection event. V374 Peg manifested low-frequency radio emission with high brightness temperature and low degree of polarisation, suggesting an electron-cyclotron maser instability emission mechanism. In this work, we provide recent observational constraints on the magnetic field of both stars. Methods. We analysed spectropolarimetric observations of these M dwarfs, collected with the SpectroPolarimetre InfraRouge (SPIRou). Firstly, we refined the stellar parameters, such as effective temperature, surface gravity, and metallicity, and measured the average surface magnetic flux via modelling of Zeeman broadening in unpolarised spectra. We then applied Zeeman-Doppler imaging to least-squares deconvolution line profiles in circular polarisation to reconstruct their large-scale magnetic fields. We also reconstructed a brightness map for the two stars using Doppler imaging. Results. StKM 1-1262 has a total, unsigned magnetic field of 3.53 0.06 kG on average, and the large-scale magnetic field topology is predominantly poloidal, dipolar and moderately axisymmetric, with an average strength of 300 G. V374 Peg has an unsigned magnetic field of 5.46 0.09 kG, and the large-scale field is poloidal, dipolar and axisymmetric, with an average strength of 800 G. For StKM 1-1262, we found a strong (Pearson = 0.96) anti-correlation between the total magnetic field and the effective temperature, which is reminiscent of the tight link between small-scale magnetic fields and surface inhomogeneities. For V374 Peg, we found a moderate ( = 0.43) anti-correlation, possibly due to a more even distribution of surface features. Conclusions. The large-scale magnetic field topology of StKM 1-1262 is similar to other stars with similar fundamental parameters like mass and rotation period, and the brightness map features one dark spot, which is responsible for the rotational modulation of the total magnetic field and the retrieved effective temperature. For V374 Peg, the magnetic topology and the brightness map are similar to previous reconstructions, indicating a temporal stability of approximately 14-yr.