The Messenger of Allah ﷺ was asked about praying on a ship. Safina said, "How shall I pray on a ship?"He replied, "Pray standing, unless you fear drowning."
سئل رسول الله ﷺ عن الصلاة في السفينة فقال: كيف أصلي في السفينة؟ فقال: صل فيها قائما إلا أن تخاف الغرق.
No references are available.
Hakim narrated it in Mustadrak (1/275), and from him Bayhaqi (3/155), via the route of Muhammad bin Hasan bin Abu Hunayn (this is how Bayhaqi has it, while Hakim has Muhammad bin Husayn bin Abu Husayn), who said, Fadl bin Dukayn told us, Jafar bin Barqan told us, from Maymun bin Mihran, from Ibn Umar, and he related the hadith.Hakim said, "Sahih in isnad according to the criterion of Muslim, though the two of them (Bukhari and Muslim) did not narrate it, and it is severely shadh." Bayhaqi said, "The hadith of Abu Naeem Fadl bin Dukayn is hasan."I say, it is as he said, for although Jafar bin Barqan is among the narrators used by Muslim, he does not rise to the level of being trustworthy, but is rather "truthful." It has another isnad, but it contains a break, as Bayhaqi said.As for what Daraqutni narrated (1/395) via the route of Bishr bin Fafa, who said, Abu Naeem told us with his isnad, and via his route Ibn Jawzi in Ilal Mutanahiya (1/415), where he said, "Bishr is unknown," this is not as he said. Rather, Bishr bin Fafa is daif, Daraqutni himself graded him daif, as stated in Mizan.This hadith has also been related from Ibn Abbas, narrated by Daraqutni, but it contains Husayn bin Alwan, who is discarded (matruk), as Daraqutni said.I say, nothing has been established as raised (marfu) in this matter other than what I have mentioned. It has been established regarding the companions that they prayed standing on a ship while able to disembark to shore, as narrated by Abdullah bin Abu Utba, who said, "I accompanied Jabir bin Abdullah, Abu Saeed Khudri, and Abu Hurairah on a ship, and they prayed standing in congregation, one of them leading them, while they were able to walk on land." This was narrated by Ibn Abu Shayba (6564), Abdul-Razzaq (4557), and Bayhaqi (1/155).Bayhaqi also narrated from Anas bin Malik that when he rode on a ship and the time for prayer came while the ship was stationary, he would pray standing, but if it was moving, he would pray sitting in congregation.This indicates the permissibility of praying on a ship even when disembarking to shore is possible.