Despite the large number of theories about the birth, evolution and present distribution of magnetic fields, some general picture seems to emerge and could be summarized as follows.
Magnetic fields were created at Inflation, as predicted and explained in the superstring theory, when the horizon was nearly independent of the cosmological scale factor. Small scale fields were washed out during the resistive radiation dominated universe, but large scale fields, larger than the horizon during the large time interval between Inflation and Recombination, escaped from magnetic diffusion and reentered as subhorizon scale fields.
Along the radiation dominated universe, magnetic flux tubes produced metric perturbations that generated filamentary concentrations of photons and other matter (including dark) components. Small scale radiative filaments, if they were actually formed, were dissipated by photon diffusion mechanisms for masses lower than the Silk mass. Similarly, small scale fields originated by phase transition were dissipated by magnetic diffusion just after Annihilation (and probably also by photon diffusion in the so called Acoustic era, just before Recombination). Large scale radiative baryonic filaments, i.e. larger than the horizon along the Radiative era, survived and reached the Recombination epoch. By the decoupling of photons, dark matter and baryons remained concentrated in the filaments. Matter filaments inheriting the properties of primordial magnetic structures formed a quasi-crystal network mainly consisting of octahedra contacting at their vertexes, reminiscent of an egg-carton topology. Magnetic fields were concentrated into the filaments and conserved their direction. Parameters defining these filaments would be (in equivalent-to-present units): length: 100 Mpc; width 10 Mpc; strength 10-9 - 10-8G, at the Recombination epoch, but also existing fractal substructures.
After Recombination, non-linear contractions leading to superclusters, clusters and galaxies corrupted and deformed the initial sharper filaments, becoming clumpy but conserving the large scale alignment. These collapses amplified the magnetic field strength from 3 × 10-9G to 10-6G, and galaxies therefore formed out of a microgauss magnetized medium. From the early stages, magnetic fields played an important role in the dynamics of galaxies, mainly in the outermost disk, where they became toroidally ordered, initiated a fast rotation, introduced instabilities into the disk and produced an escape of gas; they were also in part ejected together with the gas.