Is it permissible to perform Salah on a ship or moving train? If one were to perform his fard, sunnah, or nafl would they be valid?
Whether a ship is anchored or sails out at sea, it is permissible to perform Salah whilst aboard. If a tied boat is floating on water and is not on solid ground, and the traveller is able to get off and pray on the bank, then it would not be permissible to perform fard, witr and sunnah of the Morning Prayer on a floating boat.
If a person or persons on the boat are unable to get off due to someone else’s power of decision or circumstances beyond their control, then prayer must be performed, and it is required that they pray Salah again, once on land.
The same applies for aboard a train, all prayers are permissible on a motionless train. On a moving train, all sunnah and nawafil can be prayed apart from the two sunnah of fajr. Fard, witr and the two sunnah of Fajr cannot be read on a moving train. If the time of prayer is passing whilst on a moving train, then the individual should perform his prayer on a moving train.
When the train is motionless or when the traveller has arrived at their destination, the individual or group of people should pray again.
And Allah ﷻ knows the best
Imam Ahmad Rida Khan رحمة الله تعالى عليه
Translation by Dr Musharraf Hussain Al-Azhari Translator of Majestic Quran, www.majesticquran.co.uk