There are different uses of compression in physics and engineering. By compression it is possible to measure mechanical properties of materials such as compressive strength or modulus of elasticity. Scientists do this with press machines.
When gases are compressed, their volume becomes smaller as seen in the Ideal gas law. This compression is used in gas engines, for example in the Diesel engine as in any internal combustion engine and in the steam engine.