We present a model for the seeding and evolution of magnetic fields in protogalaxies. Supernova (SN) explosions during the assembly of a protogalaxy self-consistently provide magnetic seed fields, which are subsequently amplified by compression, shear flows and random motions. Our model explains the origin of strong magnetic fields of µG amplitude within the first starforming protogalactic structures shortly after the first stars have formed. We implement the model into the MHD version of the cosmological N-body / SPH simulation code GADGET and we couple the magnetic seeding directly to the underlying multi-phase description of star formation. We perform simulations of Milky Way-like galactic halo formation using a standard ΛCDM cosmology and analyse the strength and distribution of the subsequent evolving magnetic field. Within starforming regions and given typical dimensions and magnetic field strengths in canonical SN remnants, we inject a dipole-shape magnetic field at a rate of ≈10 −9 G Gyr −1 . Subsequently, the magnetic field strength increases exponentially on timescales of a few ten million years within the innermost regions of the halo. Furthermore, turbulent diffusion, shocks and gas motions transport the magnetic field towards the halo outskirts. At redshift z≈0, the entire galactic halo is magnetized and the field amplitude is of the order of a few µG in the center of the halo and ≈10 −9 G at the virial radius. Additionally, we analyse the intrinsic rotation measure (RM) of the forming galactic halo over redshift. The mean halo intrinsic RM peaks between redshifts z≈4 and z≈2 and reaches absolute values around 1000 rad m −2 . While the halo virializes towards redshift z≈0, the intrinsic RM values decline to a mean value below 10 rad m −2 . At high redshifts, the distribution of individual starforming and thus magnetized regions is widespread. This leads to a widespread distribution of large intrinsic RM values. In our model for the evolution of galactic magnetic fields, the seed magnetic field amplitude and distribution is no longer a free parameter, but determined self-consistently by the star formation process occuring during the formation of cosmic structures. Thus, it provides a solution to the seed field problem.