It can be understood by intuition that gases can't be compressed at constant pressure or constant volume. But what is the thermodynamic reason behind it?
Compressing a gas initiates changes in its characteristics. Because you’re compressing it, the volume of space the gas occupies decreases, but a lot more happens than this alone. Compression changes the temperature and pressure of the gas too, depending on the specifics of the situation. You can understand the changes that occur using an important law in physics called the ideal gas law. This law simplifies the real-life process somewhat, but it is useful in a wide range of situations.