Of course, you can! When you have free time during the day in between your scheduled shifts, you can get off the ship and do what you please, providing that you are not scheduled to work and are back on board by the required time.
Usually, at the beginning of the contract, there will be a lot of training (on-the-job or mandatory security training and drills), so you might have short windows of time that you can “sneak out.” Later in your contract, you may be able to get more “time off” to enjoy the beautiful ports of call. Of course, that will also depend on your department, your manager, how many people work in your department, and if you are keeping up with your duties on time!
On very rare occasions, some port authorities have forbidden certain nationalities to get off the ships on their first contracts. This is out of our control to know in advance. It’s at the country’s government regulatory bodies to determine.