July 12, 2013 -- "Do it in the suit."

According to Tom Wolfe's book "The Right Stuff," that's what mission control said to Alan Shepard during Mercury-Redstone 3, when the astronaut said he needed to urinate. Shepard did as he was told. The first American to reach the stars did so in a soggy space suit.

Hunter Hollins, a historian at the National Air and Space Museum, was rereading Wolfe's book and was especially stunned by this incident. "I was really amazed and kind of incredulous that they let him urinate in his space suit," he told ABC News.

His bewilderment led him to search the NASA archives, looking for any mention of astronauts needing to relieve themselves. The results of his search are published in the current issue of Advances in Physiology Education. "It's this fascinating little window of history," said Hollins.

A couple of months before Shepard's 1961 journey to outer space, a student named Brenda Kemmerer wrote to NASA, asking where the first man in space would use the toilet. Freeman H. Quimby, from the Office of Life Science Programs at NASA, wrote back. "The first space man is not expected to have 'to go,'" he replied.

Shepard was only expected to be in the spacesuit for about five hours. However, due to launch delays, he endured eight hours in the suit. During those extra hours, he relieved himself. "The urine flowed into his suit and short circuited some of the electrodes that were monitoring his heart and respiration," said Hollins.

Even though NASA expected its astronauts to not urinate, another government agency did. Engineers at the CIA that were involved with the U-2 spy plane project created an external urine collection device (UCD) back in 1955. Like its name implies, the UCD collects urine and transports it to an external compartment. Even though both the CIA and NASA are government agencies, the UCD technology was not shared between the two.

NASA was just slightly more prepared for its second flight, Mercury-Redstone 4. Gus Grissom, the astronaut for this mission, wore two pairs of rubber pants so that his urine would be contained in the reservoir between them. Though it worked, there was still room for improvement. At a conference held after Grissom's flight, NASA scientists agreed "to make more rigid demands on urine collection."

B.F. Goodrich, the company in charge of manufacturing NASA's spacesuits, had developed a prototype UCD, it failed to keep the urine fully contained. The test subjects refused to use it because it leaked. NASA hired James McBarron to address the problem head on.

McBarron and his colleagues searched for a better way to make a UCD, eventually turning to condoms for inspiration. "McBarron actually did a lot of the testing on his own, buying condoms and seeing which ones wouldn't leak," said Hollins.

After McBarron found a brand that met his standards, he worked with the company and modified its product. The space suit condom would have an open end that would fit snugly on an external storage container. McBarron's UCD was implemented on John Glenn's flight on the Mercury-Atlas 6 mission in 1962, and used for both the remainder of the Mercury Project, as well as through any flight that required a pressurized space suit.

Other groups have figured out how to deal with both urine and feces collection and storage since then. A NASA document written by James Lee Broyan, Jr describes the history of waste collection systems beyond the spacesuit.

For those curious to see a urine receptacle in action, Michael Barratt filmed how he and his two colleagues use one aboard the Soyuz TMA-14 flight.

No, it's not them actually urinating.

Yes, the gentlemen do wipe up after themselves.