Yes, you can come and go as you please. Just know that there is usually a line to get back on, have to show your KTTW card and then there is a line for the elevators, usually. It just eats up a little time.
But if you wanted to enjoy Castaway Cay for the day, go back to the ship, shower and change and then go back on the island to take pictures, etc., certainly is doable.
In Nassau, the ship might be docked at the far end of the pier, so it is a little hike, but you can do it.