There are three ways:
(1) For urinating, astronauts use a long tube ending
with a funnel or cuff (for males), or a cup (for females).
A vacuum system sucks the waste away.
Some systems vent the urine into space (there was an
example of this in the movie Apollo 13) but modern
space toilets are designed to recycle urine into
(2) For solid waste, astronauts use a special toilet with
a seat belt and straps to hold the astronaut in place.
The seat is contoured to form a complete seal.
A suction system removes waste. The waste is exposed
to vacuum to kill bacteria and remove odour, then
stored in containers. Sometimes this waste is brought
back to earth, sometimes it is ejected towards Earth
with other rubbish to burn up in the atmosphere.
(3) Sometimes astronauts can't get to a toilet;
for example, during takeoff, landing and EVAs
(spacewalks). In these cases they wear adult nappies.
Using the space toilet requires some precision. Astronaut Mike Mullane describes the training
for this delicate task:
"NASA installed a camera at the bottom of the toilet simulator transport tube. A light inside the
trainer provided illumination to a part of the body that normally didn't get a lot of sunshine.
A monitor was placed directly in front of the trainer with a helpful crosshair marker to designate
the exact center of the transport tube. In our training we would clamp ourselves to this toilet and
wiggle around until we were looking at a perfect bull's-eye. When that was achieved, we would
memorize the position of our thighs and buttocks in relation to the clamps and other seat landmarks"
* To help reduce the need to defecate in space, astronauts clean their bowels out before launch
and eat a low-residue diet.
* There have been rumours of unfortunate "accidents" in early space missions.
* The International Space Station toilet has been plagued by problems, requiring numerous repairs
and being regularly mocked in the news. The toilet is arguably the most famous part of the
whole space station.