The cosmological evolution of the binary black hole (BH) merger rate and the energy density of the gravitational-wave (GW) background are investigated. To evaluate the redshift dependence of the BH formation rate, BHs are assumed to originate from low-metallicity stars, and the relations between the star formation rate, metallicity and stellar mass of galaxies are combined with the stellar mass function at each redshift. As a result, it is found that when the energy density of the GW background is scaled with the merger rate at the local Universe, the scaling factor does not depend on the critical metallicity for the formation of BHs. Also taking into account the merger of binary neutron stars, a simple formula to express the energy spectrum of the GW background is constructed for the inspiral phase. The relation between the local merger rate and the energy density of the GW background will be examined by future GW observations.