“Magnetic fields are observed on nearly all scales in the universe, from stars and galaxies upto galaxy clusters and even beyond. The origin of cosmic magnetic fields is still an open question, however a large class of models puts its origin in the very early universe. A magnetic dynamo amplifying an initial seed magnetic field could explain the present day strength of the galactic magnetic field. However, it is still an open problem how and when this initial magnetic field was created. Observations of the cosmic microwave background (CMB) provide a window to the early universe and might therefore be able to tell us whether cosmic magnetic fields are of primordial, cosmological origin and at the same time constrain its parameters.” source: Cosmological Magnetic Fields , by Kerstin E. Kunze, arXiv.org, astro-ph,arXiv:1307.2153.
Magnetic fields have been detected in deep space, and are assumed to have played an important role in the physics of star formation - as they would affect angular momentum of particles in 'protostellar' clouds..
It's generally assumed that some kind of dynamo mechanism amplifies an initial seed magnetic field (created at the Big Bang) up to the present day μG level.
"The origin of the initial seed magnetic field is still an open problem".