Investigating electronic structure and excitations under extreme conditions gives access to a rich variety of phenomena. High pressure typically induces behavior such as magnetic collapse and the insulator-metal transition in 3d transition metals compounds, valence fluctuations or Kondo-like characteristics in $f$-electron systems, and coordination and bonding changes in molecular solids and glasses. This article reviews research concerning electronic excitations in materials under extreme conditions using inelastic x-ray scattering (IXS). IXS is a spectroscopic probe of choice for this study because of its chemical and orbital selectivity and the richness of information it provides. Being an all-photon technique, IXS has a penetration depth compatible with high pressure requirements. Electronic transitions under pressure in 3d transition metals compounds and $f$-electron systems, most of them strongly correlated, are reviewed. Implications for geophysics are mentioned. Since the incident X-ray energy can easily be tuned to absorption edges, resonant IXS, often employed, is discussed at length. Finally studies involving local structure changes and electronic transitions under pressure in materials containing light elements are briefly reviewed.