The origin of the magnetic fields observed in galaxies and clusters of galaxies is debated. Very little is known about their existence before and after the time of recombination, their evolution, and the possible impact they could have on galaxy and structure formation. We very briefly give the outlines of the main scenarios proposed for the magnetic fields in the ICM, without going into the details, which can be found in the literature [4, 5].
According to the first scenario, cluster magnetic fields may be primordial, i.e. generated in the early universe prior to recombination . In this case, magnetic fields would be already present at the onset of structure formation, and would be a remnant of the early Universe. One mechanism for the generation of primordial fields involves the "Biermann battery" effect , which occurs when the gradients of electron pressure and number density are not parallel, thus electrostatic equilibrium is no longer possible. This leads to a thermoelectric current which generates an electric field (and a corresponding magnetic field) that restores force balance. Other possibilities might be that weak seed fields were formed in the phase transitions of the early Universe, such as a quark-hadron (QCD), or electroweak (EW) transition, where local charge separation occurs creating local currents, or during inflation, where electromagnetic quantum fluctuations are amplified . Values of these seed fields are of the order of ~ 10-21 G.
In principle, the presence of magnetic fields in the very early Universe might be detectable through their effect on the Big Bang nucleosynthesis, or if the expansion is observed to be anisotropic. Current observations of anisotropy in the CMB place weak upper limits (B < 5 × 10-9 G) on the strength of a homogeneous component of a primordial magnetic field generated in this way . By analyzing the effect of the inhomogeneities in the matter distribution of the universe on the Faraday rotation of distant QSOs, limits of B < 10-9 -10-8 G are obtained , depending on the assumed scales of the fluctuations.
Another scenario is that the cosmological magnetic fields are generated in later epochs of the Universe. Gnedin et al.  argued that the strongest "Biermann battery" effects are likely to be associated with the epoch of cosmological reionization. Kulsrud et al.  investigated the possibility that the field may be protogalactic, i.e. generated during the initial stages of the structure formation process, during the protogalaxy formation.
A third scenario involves the galactic origin, i.e. ejection from galactic winds of normal galaxies or from active and starburst galaxies [171, 172]. Galaxy outflows, gas stripping, ejection from the AGN by radio jets, all contribute to deposit magnetic fields into the ICM. Galactic fields may be arise from the fields in the earliest stars, then ejected into the interstellar medium by stellar outflows and supernova explosions. Alternatively, fields in galaxies may result directly from a primordial field that is adiabatically compressed when the protogalactic cloud collapses. Indeed, battery mechanism on galactic scales can generate fields up to 10-19 G.
Support for a galactic injection in the ICM comes from the evidence that a large fraction of the ICM is of galactic origin, since it contains a significant concentration of metals. However, fields in clusters have strengths and coherence size comparable to, and in some cases larger than, galactic fields . Therefore, it seems quite difficult that the magnetic fields in the ICM derive from ejection of the galactic fields. The recent observations of strong magnetic fields in galaxy clusters suggest that the origin of these fields may indeed be primordial.
The observed field strengths greatly exceed the amplitude of the seed fields, or of fields injected by some mechanism. Therefore, magnetic field amplification seems unavoidable. Dynamo effect can be at work. A magnetic dynamo consists of electrically conducting matter moving in a magnetic field in such a way that the induced currents maintain and amplify the original field . The essential features of the galactic dynamo model are turbulent motions in the interstellar medium, driven by stellar winds, supernova explosions, and hydromagnetic instabilities.
In addition, amplification can occur during the cluster collapse. During the hierarchical cluster formation process, mergers generate shocks, bulk flows and turbulence within the ICM. The first two of these processes can result in some field amplification simply through compression. However, it is the turbulence which is the most promising source of non-linear amplification. MHD calculations have been performed [160, 173, 174] to investigate the origin, distribution, strength and evolution of the magnetic fields. The results of these simulations show that cluster mergers can dramatically alter the local strength and structure of cluster-wide magnetic fields, with a strong amplification of the magnetic field intensity. The initial field distribution at the beginning of the simulations at high redshift is irrelevant for the final structure of the magnetic field. The final structure is dominated only by the cluster collapse. Fields can be amplified from values of ~ 10-9 G to ~ 10-6 G.
Roettiger et al.  found a significant evolution (see Fig. 12) of the structure and strength of the magnetic fields during two distinct epochs of the merger evolution. In the first, the field becomes quite filamentary as a result of stretching and compression caused by shocks and bulk flows during infall, but only minimal amplification occurs. In the second, amplification of the field occurs more rapidly, particularly in localized regions, as the bulk flow is replaced by turbulent motions. Shear flows are extremely important for the amplification of the magnetic field, while the compression of the gas is of minor importance. Mergers change the local magnetic field strength drastically. But also the structure of the cluster-wide field is influenced. At early stages of the merger the filamentary structures prevail. This structure breaks down later (~ 2-3 Gyr) and leaves a stochastically ordered magnetic field.
Figure 12. Three-dimensional numerical MHD simulations of magnetic field evolution in merging clusters of galaxies 174]. The evolution of gas density (column 1), gas temperature (column 2), and magnetic pressure (column 3) in two-dimensional slices taken through the cluster core in the plane of the merger. The four rows represent different epoch during the merger: t = 0,1.3, 3.4, and 5.0 Gyr, respectively.