A safety pin is a small, sharp, metal fastener with a clasp on one end that protects you from getting poked. If you lose a button on your shirt, you can secure it with a safety pin.
Safety pins get their name from the fact that they're safer than straight pins. A spring mechanism allows a safety pin to form a closed loop with a covered point. You can pin up your hem or pin a name tag on your t-shirt without fear of being jabbed. Safety pins were invented in the 1840s and have remained popular; in the 1970s and 80s, clothing decorated with dozens of safety pins was a hallmark of punk rock fashion.