If the ship is nearing a stop, they may wait until they get to a port. If not, they consider what is close by, or if the U.S. Coast Guard (or equivalent officials in other countries) are available to them, who can provide an evacuation by helicopter, or by boat if they are closer to shore.