Planck has mapped the polarized dust emission over the whole sky, making it possible to trace the Galactic magnetic field structure that pervades the interstellar medium (ISM). We combine polarization data from Planck with rotation measure (RM) observations towards a massive starforming region, the Rosette Nebula in the Monoceros molecular cloud, to study its magnetic field structure and the impact of an expanding H ii region on the morphology of the field. We derive an analytical solution for the magnetic field, assumed to evolve from an initially uniform configuration following the expansion of ionized gas and the formation of a shell of swept-up ISM. From the RM data we estimate a mean value of the line-of-sight component of the magnetic field of about 3 μG (towards the observer) in the Rosette Nebula, for a uniform electron density of about 12 cm −3 . The dust shell that surrounds the Rosette H ii region is clearly observed in the Planck intensity map at 353 GHz, with a polarization signal significantly different from that of the local background when considered as a whole. The Planck observations constrain the plane-of-the-sky orientation of the magnetic field in the Rosette's parent molecular cloud to be mostly aligned with the large-scale field along the Galactic plane. The Planck data are compared with the analytical model, which predicts the mean polarization properties of a spherical and uniform dust shell for a given orientation of the field. This comparison leads to an upper limit of about 45• on the angle between the line of sight and the magnetic field in the Rosette complex, for an assumed intrinsic dust polarization fraction of 4%. This field direction can reproduce the RM values detected in the ionized region if the magnetic field strength in the Monoceros molecular cloud is in the range 6.5-9 μG. The present analytical model is able to reproduce the RM distribution across the ionized nebula, as well as the mean dust polarization properties of the swept-up shell, and can be directly applied to other similar objects.