It's true. In fact, if you are an astronaut who goes on space walks often, you might even be at risk for losing your fingernails.
National Geographic reports that the design of astronauts’ space suit gloves can lead to hand and finger injuries, including an icky condition called fingernail delamination in which the nail completely detaches from the nailbed. While missing nails do grow back in time, if the nail falls off in the middle of a spacewalk it can snag inside the glove, and moisture inside the glove can lead to bacterial or fungal infections in the exposed nailbed. MIT astronautics professor Dava Newman told National Geographic that astronauts take this medical prospect seriously. ...Be careful up in the cold blackness, walkers among the stars. And make sure you trim your nails before going outside.
The problem begins when the astronaut’s space suit is pressurized for a spacewalk (more technically called an extravehicular activity, or EVA), which makes the flexible fabric of the gloves hard and stiff. Newman decided to determine how these rigid gloves could make fingernails fall off, and found to her surprise that fingernail delamination was not linked to the length of astronauts’ fingers, which would cause more contact between the nails and the glove. Instead, astronauts with wide hands reported losing the most nails on the job. Her study, to be published in a forthcoming issue of the journal Aviation, Space, and Environmental Medicine, focused on measurements of the metacarpophalangeal joint, where the fingers meet the palm.