A space suit is an astronaut's last line of defense in space. When something goes wrong, and seals don't work on the International Space Station, or another spacecraft, astronauts have to put on their space suits for protection.
Space suits are also used during the launching, docking, and landing of spacecraft. In case any leaks are present in the process, and oxygen escapes the cabin, the space suit contains its own oxygen supply that allows the astronaut to breathe.
Although the space suits are protective, the trade-off is that they're uncomfortable. They are hot inside, and they are puffy, which makes it hard to work in certain conditions. Nonetheless, astronauts are trained to work in these conditions.