From the Super Mario Wiki
The Compressor is an object in the Wario Land series. When Wario walks under one, the Compressor squishes Wario and transforms him into Flat Wario, allowing him to crawl into small spaces. Despite its effects, they do not harm Wario or any enemy in any sort of way. These objects mainly appear in factory levels (such as The Curious Factory), and some Puzzle Rooms. There is always a Decompressor or a body of water that returns Wario to his normal size and shape.