  The NANOGrav, Parkes, European, and International Pulsar Timing Array (PTA)
Collaborations have reported evidence for a common-spectrum process that can
potentially correspond to a stochastic gravitational wave background (SGWB) in
the 1--100 nHz frequency range. We consider the scenario in which this signal
is produced by magnetohydrodynamic (MHD) turbulence in the early Universe,
induced by a nonhelical primordial magnetic field at the energy scale
corresponding to the quark confinement phase transition. We perform MHD
simulations to study the dynamical evolution of the magnetic field and compute
the resulting SGWB. We show that the SGWB output from the simulations can be
very well approximated by assuming that the magnetic anisotropic stress is
constant in time, over a time interval related to the eddy turnover time. The
analytical spectrum that we derive under this assumption features a change of
slope at a frequency corresponding to the GW source duration that we confirm
with the numerical simulations. We compare the SGWB signal with the PTA data to
constrain the temperature scale at which the SGWB is sourced, as well as the
amplitude and characteristic scale of the initial magnetic field. We find that
the generation temperature is constrained to be in the 1--200 MeV range, the
magnetic field amplitude must be $>1$\% of the radiation energy density at that
time, and the magnetic field characteristic scale is constrained to be $>10$\%
of the horizon scale. We show that the turbulent decay of this magnetic field
will lead to a field at recombination that can help to alleviate the Hubble
tension and can be tested by measurements in the voids of the Large Scale
Structure with gamma-ray telescopes like the Cherenkov Telescope Array.
