Regarding any article that is neither a garment nor an ornament, one is forbidden to walk out with it into a public domain or into a ‘karmelis’ (a Rabbinically prohibited domain, such as a side street or yard, where there is no Eruv). Therefore, one may not go out with a needle stuck into his or her garment, or even an eye-less stick pin. If one needs the pin to hold clothing, a man should follow the stringent view on this matter and not go out with it, while a woman may be lenient (i.e. a pin without an eye.) The reason for this distinction is that a woman commonly fastens ribbons, kerchiefs and similar things with stick pins, so that kind of pin is considered to be part of her attire.
[Ed: A slightly more lenient opinion is presented here in The 39 Melachos, by Rabbi Dovid Ribiat, (Vol. IV - p. 1364-5): “… The status of objects that are attached to garments is determined by the same halachic standards as objects upon a person directly… As a rule, objects attached or connected to a garment that are functional accessories of the garment (whether to hold the garment up or for stylistic purposes) may be worn outside just as the garment itself. This is because an accessory is viewed as an extension of the garment… even if presently not being used or needed. Examples: buttons, hooks, loops, safety pins (i.e. currently pinning a tear or replacing a button – if the pin serves no purpose, it should be removed before going out) … Adornments to a garment are also considered part of the garment itself. One is therefore permitted to go out with a garment to which decorative and ornamental accessories are attached. Examples: Decorative buttons (even if not functional), decorative pins, ribbons, fringes…”]