  In this work, we analyze the implications of graviton to photon conversion in
the presence of large scale magnetic fields. We consider the magnetic fields
associated with galaxy clusters, filaments in the large scale structure, as
well as primordial magnetic fields. {We analyze the interaction of these
magnetic fields with an exogenous high-frequency gravitational wave (HFGW)
background which may exist in the Universe. We show that, in the presence of
the magnetic fields, a sufficiently strong HFGW background would lead to an
observable signature in the frequency spectrum of the Cosmic Microwave
Background (CMB).} The sensitivity of current day CMB experiments allows to
place significant constraints on the strength of HFGW background,
$\Omega_{GW}\lesssim1$. These limits are about 25 orders of magnitude stronger
{than currently existing direct constraints} in this frequency region.
