Assalamualaikum ustaz. I’d usually travel on a train such as ETS (Electric Train Services) for my long-distance journeys. I want to ask the ruling of praying on a train and how should I determine the qibla direction on the moving train? Hope for an explanation.
Waalaikumussalam wrt. wbt.,
Alhamdulillah, praise and gratitude to Allah SWT for His countless blessings for us all. Praise and salutations to our beloved Prophet Muhammad PBUH, his family, companions, and all those who follow his footsteps until the Final day.
Railway services are one of the best choices in public transport since it is efficient transportation for many people without having to face any traffic jams. It is also time-saving because of the high speed it is able to travel.
A train is a type of transportation that consists of several carriages linked to travel together on the railroad.  Railroads often consist of conventional rails. Nowadays, some trains use monorail  or maglev systems . The thrust of a train comes from a variety of sources. Usually, locomotives or self-propelled units are used. 
According to the Land Public Transport Agency (APAD), there are eleven (11) types of trains in Malaysia, namely monorail, MRT, KLIA Aerotrain, KTM Intercity, Electric Train Service (ETS), KTM Commuter, Skypark Link, KTM Cargo, Klang Valley MRT Project (KVMRT), Light Rail Transit (LRT) and KLIA Express & Transit. 
ETS stands for Electric Train Service, an inter-city high-speed train service spanning between Penang Sentral, Butterworth and Kuala Lumpur introduced by Keretapi Tanah Melayu on 12th August 2010. 10 stations are serving along this route, there are three in Perak, two in Selangor, three in Kuala Lumpur and two more in Negeri Sembilan.
The maximum operating speed of the ETS is 145 km/h, although the ETS trains are designed to reach speeds of 160 km/h. Each train can carry a maximum of 350 passengers and consists of six carriages that reach a total length of 138 m and weigh 231.8 tons. Each wagon is 22.95 m long, 2.75 m wide and 4 m high. 
Definition of Qibla
Lexically, qibla means direction (al-jihah) where we pray facing it and according to syara’ terminology, it can be understood as Kaaba without having any other meaning. 
There is no khilaf among the jurists that facing the qibla is among the valid conditions of prayer for those who are able to do so. 
Facing the Qibla as A Valid Condition of Prayer
According to the book al-Fiqh al-Manhaji it is stated: “What is meant by the qibla is Kaaba while facing the qibla means facing the Kaaba. The evidence of this condition is the statement of Allah SWT:
وَمِنْ حَيْثُ خَرَجْتَ فَوَلِّ وَجْهَكَ شَطْرَ الْمَسْجِدِ الْحَرَامِ ۚ وَحَيْثُ مَا كُنتُمْ فَوَلُّوا وُجُوهَكُمْ شَطْرَهُ
“And from wherever you go out [for prayer], turn your face toward al-Masjid al-Haram. And wherever you [believers] may be, turn your faces toward it,” 
Likewise, in a hadith, Rasullullah PBUH said to people he is teaching how to pray:
إِذَا قُمْتَ إِلَى الصَّلاَةِ فَأَسْبِغِ الْوُضُوءَ، ثُمَّ اسْتَقْبِلِ الْقِبْلَةَ فَكَبِّرْ
“When you get up to pray, perform the ablution completely, and then turn towards Qibla and recite takbir.” 
The meaning of al-Haram Mosque in the verse and qibla in the hadith is Kaaba… A person who is praying regardless of whether he is near the Kaaba and he can see it or far from it where it is impossible for him to see it. A person near the Kaaba is obligated to face the Kaaba with certainty whilst for those who are far away from the Kaaba, then it is obligatory for him to face it following strong guidelines from a sure and accurate guide.” 
Facing the qibla means facing with one’s chest, not just with his head for a person who is praying while standing and sitting; with his face and chest for a person who is lying on his side; and with his head and toes for those who pray on their supine. 
For those who are far away from the Kaaba or those who are hindered or blocked from looking straight at the Kaaba, then it doesn’t affect his prayer if his position is a bit to the right or a bit to the left from the Kaaba itself, for it is just a slight mistake as long as it doesn’t deviate from the direction of the Kaaba. 
In madhhab al-Syafie, the methodology to determine the qibla is according to the four priority orders, which are:
- One’s own certain knowledge, such as a person who can see the Kaaba itself or a blind person who can touch the Kaaba.
- Information from a trusted person.
- Ijtihad made using a compass or others.
- A person who taqlid to the ijtihad of another person. 
The Ruling of Praying in A Vehicle
Generally, the discussion regarding the above-presented issue has a basis as mentioned in several narrations. Among them is a hadith narrated by ‘Amir bin Rabi’ah, he said:
رَأَيْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ وَهُوَ عَلَى الرَّاحِلَةِ يُسَبِّحُ يُومِئُ بِرَأْسِهِ قِبَلَ أَيِّ وَجْهٍ تَوَجَّهَ وَلَمْ يَكُنْ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَصْنَعُ ذَلِكَ فِي الصَّلَاةِ الْمَكْتُوبَةِ
“I saw the Prophet (ﷺ) on his Mount praying Nawafil by nodding his head, whatever direction he faced, but Allah’s Messenger (ﷺ) never did the same in offering the compulsory prayers.” 
According to the above hadith, an animal mount is a vehicle used by people in previous times including the time of Rasullullah PBUH. Hence, modern vehicles such as cars, aeroplanes, trains, boats and others also use the same rulings with animal mounts.
Thus, in general, it is permissible for a person to pray on a vehicle. However, what is the category of prayer meant in the above hadith? Is it meant for obligatory prayer or does it only refer to sunnah prayer?
Al-Hafiz Ibn Hajar al-Asqalani when commenting on this hadith places it under “Chapter the Prophet PBUH Disembark (from his animal mount) for Obligatory Prayer.”
This indicates that the prayer that is permissible to be performed on or in a vehicle is only for sunnah prayer. Whilst for obligatory prayer, scholars state that a person must disembark from his animal mount to perform it. In other words, one cannot perform the obligatory prayer when he is on his animal mount.
Ibn Hajar cited the opinion of Ibn Batthal in this issue, where he said: “Scholars have agreed that the condition on this matter (disembarking from an animal mount) and indeed, it is impermissible for a person to perform obligatory prayer when he is still on his animal mount without any debility.”
He further added: “The word يُسَبِّحُ refers to sunnah prayer. This is based on several hadiths that support this matter.” 
We divided the details of praying in a vehicle into the following two points related to the type of vehicle one is on:
- First: Praying on vehicles such as the train or aeroplane
In this issue, it is permissible for a person to pray in it, regardless of whether it is sunnah or obligatory prayer. This considering the long time the journey takes customarily when one takes this type of transportation. Furthermore, it is impossible for a person to disembark from this type of vehicle just to perform prayer except when he arrives at the destination. Thus, it is clearly different from the concept of praying on an animal mount.
Second: Praying on an animal mount.
Regarding praying on animal mounts such as horses and camels, it is similar to the characteristics of cars which are the modern version of it today. The reason is a person who is in a car can easily stop and went to pray outside of his vehicle. This takes into account the situation in our country where it is very conducive and there are numerous praying places provided. For example, the surau in the Rest and Recreation (R&R), petrol stations and others.
The Ruling of Praying on A Train
Hence, regarding the ruling of praying on a train, the ruling of praying on an animal mount such as a horse and camel isn’t applicable on it. This means it is permissible for a person to perform the obligatory prayer on a train.
Although, we’d also like to state that certain situations should be differentiated as the following:
- If the train journey is long and this permits him to perform jamak takhir when he arrives at his destination, then this is easier for him to perform his prayer comfortably.
- However, if the journey is long but he isn’t able to perform jamak and if he doesn’t pray then he’d miss the prayer, then it is permissible for him to pray on the train.
- Regarding the matter of the direction of qibla, it is necessary for the person to face the qibla when he is praying. The reason is facing the qibla is one of the valid conditions of prayer. This follows the statement of Allah SWT:
فَوَلِّ وَجْهَكَ شَطْرَ المَسْجِدِ الحَرَام
“So, turn your face toward al-Masjid al-Haram.” 
Al-Imam al-Qurthubi when interpreting this verse said: Turn your face to Masjid al-Haram means the Kaaba. 
However, this is exempted if there is a debility for him to face the qibla, then it is permissible for him to face the direction closest to the qibla. However, if this is also impossible for him, then we suggest the prayer be repeated (I’adah) if there is still time remaining or qadha the prayer as soon as he arrives at the destination if the time is over.
In the above issue, we state that the ruling of praying on a high-speed train of which the journey takes a long time such as the ETS (Electric Train Service) is permissible. If a person feels it is difficult to pray on the train and this results in the time for the prayer has passed, then according to madhhab Syafie, it is permissible for him to perform the prayer respecting the time on the train and then qadha his prayer when he arrives at his destination.
 Monorail is a public transportation system based on a single beam track. The term is also used to describe the track for the system, as well as the vehicles that pass through it. The term is derived from a combination of the words mono (singular) and rail.
 Maglev trains (magnetic levitation, literal translation: magnetic flotation) are a form of a transportation system that uses electromagnetic forces. The force is used to float, drive and propel vehicles (especially trains). This method is faster and quieter than other wheeled public transportation systems.
 See Mughni al-Muhtaj, 1/142
 See al-Mausu’ah al-Fiqhiyyah al-Kuwaitiyyah, 32/302
 Narrated by al-Bukhari (5897) and Muslim (397)
 See al-Fiqh al-Manhaji, 1/127-128