Ever since Yuri Gagarin was first launched into space on April 12, 1961, engineers and space travelers have had to answer the problem of how to go and where to put the waste.
In the first years of the National Aeronautics and Space Administration (NASA), manned space flights were to be so short that the astronauts were reasonably expected to hold it.
Yet on May 5, 1961, astronaut Alan Shepard was forced to sit through some hours of delays, he needed to pee. With no good options available, Shepard was allowed pee in his spacesuit after its electronics were temporarily de-activated.
In February 1962, NASA engineers had developed a sealed system that connected the astronaut to a secure storage system via a condom-like device. By the time the Apollo-11 astronauts landed on the moon on July 20, 1969, NASA had developed a urine and fecal containment system worn by the astronauts under their spandex.
For space walks and other suit work, special high-tech diapers were (and still are) worn that can absorb an astonishing amount of liquid.
In addition, by the time of the shuttle era, a special space privy had been developed. Relying on air pressure, the toilet worked by a simple design. Liquid waste is sucked into a plastic funnel on the end of the trunk-like tube and deposited into the base’s urine container, which vents into space when filled. Outside, the urine sublimates and eventually turns into gas. Solid waste was also sucked straight into a bowl, but then stored until the craft returns to Earth.