When you pull into your port of call it usually takes 30 minutes for local authorities to clear the ship at which point the CruiseDirector or Captain will announce that passengers may now disembark the ship. You should bring with you cash/credit card, your room key, and your passport.
When you are leaving the ship you should always double-check what time you must be back onboard. The ship will not wait for you if you are late and you will be responsible (physically and financially) for either getting yourself to the next port of call or to fly yourself back home.