Use the phrase when you want to stress that everyone's contribution is needed, not just a few people. With the deadline tonight, it's all hands on deck to finish the project.
Pro Tip 2/3
Urgent Situations
It often implies urgency or a situation that requires immediate attention and action from everyone. The fundraiser is tomorrow, so it's all hands on deck getting everything prepared.
Pro Tip 3/3
Informality
It's a casual expression, so it's appropriate for relaxed or informal environments, not formal contexts. We're moving to a new office this weekend, and it's all hands on deck.