Though the origin of the term panic button is one that can be traced anecdotally to Americans air crews stationed in Britain during WWII, it does not show up in print until the 1950’s.
The actual “panic button” itself was a fixture in the bombers of the era and was used by the pilot to signal the rest of the crew that it was time to bail out as things had gone exceptionally wrong.
Panic itself is derived from the Greek god Pan who among other things was the god of shepherds woods and pastures. Normally a jovial figure that traversed the woods playing his pipes he could easily be startled from his frequent naps and his shock and surprise would cause him to launch into loud protestations that would cause the flocks to stampede. The word for this, panikon, means “sudden fear” which eventually came to English as panic.