  We review current ideas on the origin of galactic and extragalactic magnetic
fields. We begin by summarizing observations of magnetic fields at cosmological
redshifts and on cosmological scales. These observations translate into
constraints on the strength and scale magnetic fields must have during the
early stages of galaxy formation in order to seed the galactic dynamo. We
examine mechanisms for the generation of magnetic fields that operate prior
during inflation and during subsequent phase transitions such as electroweak
symmetry breaking and the quark-hadron phase transition. The implications of
strong primordial magnetic fields for the reionization epoch as well as the
first generation of stars is discussed in detail. The exotic, early-Universe
mechanisms are contrasted with astrophysical processes that generate fields
after recombination. For example, a Biermann-type battery can operate in a
proto-galaxy during the early stages of structure formation. Moreover, magnetic
fields in either an early generation of stars or active galactic nuclei can be
dispersed into the intergalactic medium.
