We have performed magnetohydrodynamics (MHD) simulations of the collapse and fragmentation of molecular cloud cores using a new algorithm for MHD within the smoothed particle hydrodynamics (SPH) method that enforces the zero magnetic divergence constraint. We find that the support provided by magnetic fields over thermal pressure alone has several important effects on fragmentation and the formation of binary and multiple systems, and on the properties of massive circumstellar discs. The extra support suppresses the tendency of molecular cloud cores to fragment due to either initial density perturbations or disc fragmentation. Furthermore, unlike most previous studies, we find that magnetic pressure plays the dominant role in inhibiting fragmentation rather than magnetic tension or magnetic braking. In particular, we find that if the magnetic field is aligned with the rotation axis of the molecular cloud core, the effects of the magnetic field on fragmentation and disc structure are almost entirely due to magnetic pressure, while if the rotation axis is initially perpendicular to the magnetic field, magnetic tension plays a greater role and can actually aid fragmentation. Despite these effects, and contrary to several past studies, we find that strongly perturbed molecular cloud cores are able to fragment to form wide binary systems even in the presence of quite strong magnetic fields. For massive circumstellar discs, we find that slowing of the collapse caused by the magnetic support decreases the mass infall rate on to the disc and, thus, weakens gravitational instabilities in young massive circumstellar discs. This not only reduces the likelihood that they will fragment, but also decreases the importance of spiral density waves in providing angular momentum transport and in promoting planet formation.