  Recently, the NANOGrav collaboration has reported evidence for a
common-spectrum stochastic process, which might be interpreted as the first
ever detection of stochastic gravitational wave (GW) background. We discuss the
possibility of the signal arising from the first and second-order GWs in
nonstandard cosmological history. We show that the NANOGrav observation can be
explained by the first order GWs in the nonstandard thermal history with an
early matter-dominated era, whereas the parameter space required to explain the
NANOGrav observation in the standard cosmology or in the nonstandard epoch of
kination domination is ruled out by the BBN and CMB observations. For the
second-order GWs arising from the large primordial scalar fluctuations, we
study the standard radiation domination and two specific nonstandard cases with
a few forms of the primordial power spectrum $P_{\zeta}(k)$ to achieve abundant
primordial black hole (PBH) production. We find that the NANOGrav observation
can be explained with standard radiation domination for all of these
$P_{\zeta}(k)$. Furthermore, a dustlike epoch leads to abundant PBH formation
for a lower amplitude of $P_{\zeta}(k)$ than the radiation dominated case and
complies with the NANOGrav observation only for a few of the all $P_{\zeta}(k)$
forms considered here, where the peak wavenumber is larger than the wavenumber
range probed by the NANOGrav. In this nonstandard epoch, for a broad power
spectrum, PBHs are produced in a wide mass range in the planetary mass regime.
A nonstandard epoch of kination domination cannot produce enough PBH for any of
the $P_{\zeta}(k)$ if the NANOGrav result is to be satisfied.
