Two-fluid quantum magnetohydrodynamic (QMHD) equations are employed to investigate linear and nonlinear properties of the magnetosonic waves in a semi-relativistic dense plasma accounting for degenerate relativistic electrons. In the linear analysis, a plane wave solution is used to derive the dispersion relation of magnetosonic waves, which is significantly modified due to relativistic degenerate electrons. However, for a nonlinear investigation of solitary and shock waves, we employ the reductive perturbation technique for the derivation of Korteweg–de Vries (KdV) and Korteweg–de Vries Burger (KdVB) equations, admitting nonlinear wave solutions. Numerically, it is shown that the wave frequency decreases to attain a lowest possible value at a certain critical number density $N_{c}^{(0)}$, and then increases beyond $N_{c}^{(0)}$ as the plasma number density increases. Moreover, the relativistic electrons and associated pressure degeneracy lead to a reduction in the spatial extents of the magnetosonic waves and a strengthening of the shock amplitude. The results might be important for understanding the linear and nonlinear magnetosonic excitations in dense astrophysical plasmas, such as in white dwarfs, magnetars and neutron stars, etc., where relativistic degenerate electrons are present.