Not so far as we can tell in the history of the universe before about 1 million years after the Big Bang because there could not possibly have been any large-scale organized flows of charged particles to produce the organized currents needed to create large-scale magnetic fields. There may, however, have been a role for magnetic fields in the formation of stars out of collapsing gas clouds and the formation of some of the structure in galaxies where magnetic [pressures are known to be in rough 'equipartition' with thermal gas pressure.