Do they ever let you off the ship when you are at ports during your deployment O.O?
The short answer is: Yes.
The longer answer is: Yes, but with some conditions.
When in a foreign port, you are expected to exercise safe and responsible behavior. That means, don't get in trouble with local law enforcement. ALWAYS travel with a buddy. Be back in time for curfew.
You will probably stand duty (i.e. can't leave the ship for 24 hours) once every few days.
If you get in trouble, or prove that you can't act responsibly, your liberty in foreign ports may be limited (or removed altogether).