Sailor Dialect meaning, essentially: when you're in trouble, any way out is a good way out.
Y'see, back when people sailed the seven seas with reckless abandon, a crew was more likely to find the nearest port than to risk ship and crew in a life-threatening storm. This phrase is probably most applicable to the pirate-sorts, as this phrase suggests that anything is better than getting screwed, and pirates liked that sort of shady-around-the-edges shiznit.
Pirate #1: 'Tis cap'n's orders ter drop anchor at the nearest port!
Pirate #2: Aye, any port in the storm, sez i.
Math Student #1: Dude, I may have cheated on that math test, but I stayed up all night watching reruns of Cheers! What else was I supposed to do?
Math Student #2: Hey, any port in the storm.