I found the following puzzle by Martin Gardner in an archived copy of Isaac Asimov's Science Fiction Magazine. I've heard it before, but in a more vulgar setting, involving condoms instead of gloves.
The first earth colony on Mars has been swept by an epidemic of Barsoomian flu. The cause: a native Martian virus not yet isolated.
There is no way to identify a newly infected person until the symptoms appear weeks later. The flu is highly contagious, but only by direct contact. The virus transfers readily from flesh to flesh, or from flesh to any object which in turn can contaminate any flesh it touches. Residents are going to extreme lengths to avoid touching one another, or touching objects that may be contaminated.
Ms. Hooker, director of the colony, has been seriously injured in a rocket accident.
Three immediate operations are required. The first will be performed by Dr. Xenophon, the second by Dr. Ypsilanti, the third by Dr. Zeno. Any of the surgeons may be infected with Barsoomian flu. Ms. Hooker, too, may have caught the disease.
Just before the first operation it is discovered that the colony's hospital has only two pairs of sterile surgeon's gloves. No others are obtainable and there is no time for resterilizing. Each surgeon must operate with both hands.
"I don't see how we can avoid the risk of one of us becoming infected," says Dr. Xenophon to Dr. Zeno. "When I operate, my hands may contaminate the insides of my gloves. Ms. Hooker's body may contaminate the outsides. The same thing will happen to the gloves worn by Dr. Ypsilanti. When it's your turn, you'll have to wear gloves that could be contaminated on both sides."
"Au contraire," says Dr. Zeno, who had taken a course in topology when he was a young medical student in Paris. "There's a simple procedure that will eliminate all risk of any of us catching the flu from one another or from Ms. Hooker."
What does Dr. Zeno have in mind?