The propagation of ion-acoustic solitary waves (IASWs) in a magnetized collisionless degenerate plasma system for describing collective plasma oscillations in dense quantum plasmas with relativistically degenerate electrons, oppositely charged inertial ions, and positively charged immobile heavy elements is investigated theoretically. The perturbations of the magnetized quantum plasma are studied employing the reductive perturbation technique to derive the Korteweg–de Vries (KdV) and the modified KdV (mKdV) equations that admit solitary wave solutions. Chandrasekhar limits are used to investigate the degeneracy effects of interstellar compact objects through the equation of state for degenerate electrons in nonrelativistic and ultrarelativistic cases. The basic properties of small but finite-amplitude IASWs are modified significantly by the combined effects of the degenerate electron number density, pair ion number density, static heavy element number density, and magnetic field. It is found that the obliqueness affects both the amplitude and width of the solitary waves, whereas the other parameters mainly influence the width of the solitons. The results presented in this paper can be useful for future investigations of astrophysical multi-ion plasmas.