Resonant inelastic x-ray scattering (RIXS) is an extremely valuable tool for the study of elementary, including magnetic, excitations in matter. Latest developments of this technique mostly aimed at improving the energy resolution and performing polarization analysis of the scattered radiation, with a great impact on the interpretation and applicability of RIXS. Instead, this article focuses on the sample environment and presents a setup for high-pressure low-temperature RIXS measurements of low-energy excitations. The feasibility of these experiments is proved by probing the magnetic excitations of the bilayer iridate Sr$_3$Ir$_2$O$_7$ at pressures up to 12 GPa.