Blazar observations point toward the possible presence of magnetic fields over intergalactic scales of the order of up to ∼1 Mpc, with strengths of at least ∼10−16 G. Understanding the origin of these large-scale magnetic fields is a challenge for modern astrophysics. Here we discuss the cosmological scenario, focussing on the following questions: (i) How and when was this magnetic field generated? (ii) How does it evolve during the expansion of the universe? (iii) Are the amplitude and statistical properties of this field such that they can explain the strengths and correlation lengths of observed magnetic fields? We also discuss the possibility of observing primordial turbulence through direct detection of stochastic gravitational waves in the mHz range accessible to LISA.