Here's the breakdown:
* "Hands" referred to the crew members, especially the sailors who worked on deck.
* "On deck" meant being present and ready to work on the ship's upper deck.
When a captain needed everyone to help with a critical task, they would order "all hands on deck." This could be for anything from handling the sails during a storm to battling pirates to loading or unloading cargo.
The phrase emphasizes the need for everyone to contribute and work together during a difficult or urgent situation.
While the phrase's literal use has mostly faded with the decline of sailing ships, it remains a common idiom today. It signifies the need for everyone to work together, regardless of their role, to accomplish a shared goal.