The observed rotation measures (RMs) towards the Galactic centre magnetar and towards Sagittarius A* provide a strong constraint on MHD models of the Galactic centre accretion flow, probing distances from the black hole separated by many orders of magnitude. We show, using three-dimensional simulations of accretion via magnetized stellar winds of the Wolf-Rayet stars orbiting the black hole, that the large, time-variable RM observed for the pulsar PSR J1745-2900 can be explained by magnetized wind-wind shocks of nearby stars in the clockwise stellar disc. In the same simulation, both the total X-ray luminosity integrated over 2-10 arcsec, the time variability of the magnetar's dispersion measure, and the RM towards Sagittarius A* are consistent with observations. We argue that (in order for the large RM of the pulsar to not be a priori unlikely) the pulsar should be on an orbit that keeps it near the clockwise disc of stars. We present a two-dimensional RM map of the central 1/2 parsec of the Galactic centre that can be used to test our models. Our simulations predict that Sgr A* is typically accreting a significantly ordered magnetic field that ultimately could result in a strongly magnetized flow with flux threading the horizon at ∼10 per cent of the magnetically arrested limit.