Airplanes need to be pressurized inflight because the air outside the plane is not breathable at high altitudes.
The air is thin and contains less oxygen, which can lead to hypoxia. Pressurizing the cabin simulates a lower altitude and allows passengers to breathe normally and be comfortable during the flight.
If a plane's cabin becomes depressurized in flight, it can be a serious emergency. The sudden drop in pressure can cause the oxygen masks to drop from the ceiling and the passengers are instructed to put them on immediately. The pilot will also descend to a lower altitude where the air is thicker, and the passengers will be able to breathe more easily. If the depressurization is not addressed quickly and properly, it can lead to hypoxia, which is a lack of oxygen to the body. This can cause disorientation, unconsciousness and in severe cases, death.