NASA says this is not a space diaper, but it is. They call it the Maximum Absorbency Garment. I call it the Space Pooper. But why do astronauts use them?
Quite simply, when astronauts are sitting in the Space Shuttle, strapped to their seats and ready to go, they may experience very long delays. Sometimes even hours. And when that happens, they just can't get off their seats to go to the toilet. They just have to do it, as Alan Shepard discovered while waiting inside his Mercury capsule on May 5, 1961, waiting for the Freedom 7 mission launch. He was the first American to reach Space and the first astronaut to pee inside his suit.
Due to various technical problems, Shepard was stuck in the capsule for too long. He called his buddy Gordon Cooper, another member of the legendary Mercury Seven. At the time, Cooper was the principal pre-launch communicator at mission control:
Gordo: Go, Alan
Shepard: Man, I got to pee.
Gordo: You what?
Shepard: You heard me. I've got to pee. I've been up here forever.
He couldn't go out, but the medical team thought the liquid could short-circuit his body monitoring cables. The scientists at NASA didn't think that this could happen—Shepard's flight was going to be really short—so there were no space diapers or any other mechanism to accommodate Shepard's physiological needs. At the end, they shut down the monitoring system and Shepard was given the go for pee.
He also said "Don't fuck up, Shepard..." just before launch, but that's another story.