During the shorter duration Gemini flights, diapers were still used as the astronauts' only way to relieve themselves.  However, as the flights grew longer, a new collection system was devised. 

The first device is a collection bag for liquid wastes, and the second for solid wastes.  Once used, the bags are sealed, and stored for the flight back to earth, were they are disposed of.  Notice the "wet-naps" in the solid waste bag, for clean-up.