Imagine you're one of a group of survivors from a shipwreck, all stuck in a lifeboat. You're all in the boat, and the situation, together.
The expression makes the shipwreck and the boat metaphorical; for some reason which the speaker and those listening are assumed to understand, they are all facing the same difficult situation.