I was advised that according to the Mishnah bruraon shabbat siman 248 section gimmal that if the ship arrives before shabbat and you bring in shabbat on the ship then if you are careful not to carry you can leave and reenter the ship even if it is going to sail on shabbat because the ship becomes like a hotel or your home
It makes me happy to see that you had to ask and you were advised according the Rema and the Mishna Brura. In my answer, I had followed the ruling of one of the gdolei hador Rav Mordechai Eliyahu zt"l (who unfortunately at the time I am writing this answer is no longer alive) who when asked these questions specifically gave the ruling that if he brought in Shabbat on the ship he may stay on the ship even if sails on Shabbat as long as he does not leave the ship from the time he brought in Shabbat there. This seems to be the ruling of the Mechaber in Shulchan Aruch 248:3 which should be followed by Sfaradi Jews who follow the Shulchan Aruch and not the Rema. This could very well be the reason be why Rav Eliyahu zt"l decided what he did.(In these particular psakim, there were no sources given) Indeed the Rema, who Askenazim follow disagrees. There happens to be a major Machloket of the rishonim on this issue which is elaborated in the Bet Yoseph. The Mechaber followed Rashba, Rosh and Hagahot Oshri, while the Rema followed the Bahag, Ritva and Ran. There is furthermore a lot of difficulty in the Achronim understanding this particular paragraph (See Magen Avraham 248:10 in regard to the issue of "Shat", See Shulchan Aruch 339: 6-7, also 404, Chemed Moshe 248:5,, Aruch Hashulcan 248:13, and Rav Valdenberg zt"l in Tziz Eliezer Volume 19:20. ) . I am not worthy to explain Rav Eliyahu zt"l, but perhaps due to this difficulty and possible confusion he didn't differentiate between Askenazim and Sfardim. However, you should choose your Rav and follow him. This may be self-defeating, but a real Rabbi that you know and knows you is always a better choice than a virtual, computer-generated Rabbi.