ABSTRACT We present near-infrared spectropolarimetric observations of a sample of 43 weakly to moderately active M dwarfs, carried with SPIRou at the Canada–France–Hawaii Telescope in the framework of the SPIRou Legacy Survey from early 2019 to mid-2022. We use the 6700 circularly polarised spectra collected for this sample to investigate the longitudinal magnetic field and its temporal variations for all sample stars, from which we diagnose, through quasi-periodic Gaussian process regression, the periodic modulation and longer-term fluctuations of the longitudinal field. We detect the large-scale field for 40 of our 43 sample stars, and infer a reliable or tentative rotation period for 38 of them, using a Bayesian framework to diagnose the confidence level at which each rotation period is detected. We find rotation periods ranging from 14 to over 60 d for the early-M dwarfs, and from 70 to 200 d for most mid- and late-M dwarfs (potentially up to 430 d for one of them). We also find that the strength of the detected large-scale fields does not decrease with increasing period or Rossby number for the slowly rotating dwarfs of our sample as it does for higher-mass, more active stars, suggesting that these magnetic fields may be generated through a different dynamo regime than those of more rapidly rotating stars. We also show that the large-scale fields of most sample stars evolve on long time-scales, with some of them globally switching sign as stars progress on their putative magnetic cycles.