  The merger of dark matter halos and the gaseous structures embedded in them,
such as proto-galaxies, galaxies, and groups and clusters of galaxies, results
in strong shocks that are capable of accelerating cosmic rays (CRs) to
$\sim10~\rm PeV$. These shocks will produce high-energy neutrinos and
$\gamma$-rays through inelastic $pp$ collisions with ambient gaseous
environments. In this work, we study the contributions of these halo mergers to
the diffuse neutrino flux measured in IceCube and to the non-blazar portion of
the extragalactic $\gamma$-ray background measured by $Fermi$. In order to
calculate them, we formulate the redshift dependence of the shock velocity,
galactic radius, halo gas content and galactic/intergalactic magnetic fields
over the dark matter halo distribution up to a redshift $z=10$. We find that
high-redshift mergers contribute a significant amount of the cosmic-ray energy
luminosity density, and the resulting neutrino spectra could explain a large
part of the observed diffuse neutrino flux above 0.1 PeV up to several PeV. We
also show that our model can somewhat alleviate tensions with the extragalactic
$\gamma$-ray background. First, since a larger fraction of the CR energy
luminosity density comes from high redshifts, the accompanying $\gamma$-rays
are more strongly suppressed through $\gamma\gamma$ annihilations with the
cosmic microwave background (CMB) and the extragalactic background light (EBL).
Second, mildly radiative-cooled shocks may lead to a harder CR spectrum with
spectral indices of $1.5\lesssim s\lesssim2.0$. Our study suggests that halo
mergers, a fraction of which may also induce starbursts in the merged galaxies,
can be promising neutrino emitters without violating the existing $Fermi$
$\gamma$-ray constraints on the non-blazar component of the extragalactic
$\gamma$-ray background.
