Certain airlines can have individual rules prohibiting things however on most airlines I've went on and went through TSA the hair pins have always been allowed to go through the TSA check and I've been able to keep the hat pins on my hats when flying on the plane.
So in most cases airlines will allow hat pins on the airplanes.