Dear student,
Reason- solids have a large intermolecular force of attraction and fewer spaces between the particles, which inhibits the molecules to come closer for compression. Gases have larger spaces between them, so it is easier to take the particles closer to each other. Hence, compression is possible.
Regards.