Assalamualaikum ustaz. Some tower crane workers experienced difficulty praying because they have to come down from the high tower crane for them to pray in the place provided. If he wishes to pray inside the crane space, it is a bit cramped. When he wants to prostrate, he has to move a couple of steps backwards and when he wants to get back up to stand, he has to move a couple of steps forward again. What is the status of his prayer? 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.
Definition and Types of Towers Crane
Tower cranes are cranes used to build tall structures such as skyscrapers. The basic components of a tower crane are a vertical tower — also known as a pole — and an outstretched jib.
The Trolley and Hook Block move along the jib, which can rotate 360 degrees around the pole. Often, these cranes are installed using smaller portable cranes.
There are three different types of tower cranes:
- Hammerhead cranes
- Luffing tower cranes
- Self-erecting tower cranes 
A crane operator is a person who operates or drives a crane whether it is a Mobile Crane, Crawler Crane or Tower Crane. All three types of cranes require competent workers, who act as Crane Operators. The competencies in question are the competencies given by the Department of Occupational Safety and Health (JKKP). 
Duties as a tower crane operator include operating cranes and facilitating construction. Among them, some had to stay on the building for more than eight hours to a maximum of two days. Some of them also have to follow an unusual daily schedule which has to work six days a week and on top of that building is a place to rest, prepared food and drink are transported to the workers using ropes from below. 
The Issue of Praying in A Tower Crane
The importance of prayer is mentioned in numerous Quranic and prophetic evidences. Among them is a statement of Allah SWT:
وَأَقِيمُوا الصَّلَاةَ وَآتُوا الزَّكَاةَ وَارْكَعُوا مَعَ الرَّاكِعِينَ
“And establish prayer and give zakah and bow with those who bow [in worship and obedience].” 
The above verse is among the evidences of the sanctioning of prayer on every Muslim on this earth. Praying is an obligation as well as fardhu ‘ain of every mukallaf Muslim, that is all Muslim individual who has reached puberty, has a sane mind and are in a pure state. 
In a hadith narrated from Ibn Umar RA< he said that a man came to meet Rasullullah PBUH and asked what is the most beloved matter by Allah SWT in Islam? The Prophet PBUH replied:
الصَّلَاةُ لِوَقْتِهَا، وَمَنْ تَرَكَ الصَّلَاةَ فَلَا دِينَ لَهُ، وَالصَّلَاةُ عِمَادُ الدِّينِ
“Pray in its time, whoever misses prayer then there is no religion for him and prayer is the pillar of religion.” 
The Muslim ummah as a whole from every time and place agreed that the five prayers a day is obligatory and that it is included in the religion’s matter that is al-ma`lum min al-din bi al-darurah (an easily known fact in this religion).
In answering the above question, we state the following:
A movement that invalidates prayer is movements that exceed three times consecutively even if it is done unintentionally.
According to Abu Ishak al-Syirazi: “If a person moves three steps consecutively or hits thrice in succession, then his prayer is invalid.” 
Al-Khatib al-Syarbini said: “And the second matter that invalidates prayer is a lot of movement that is not considered as a part of the movement in prayer according to the urf (custom). What is considered as urf is a small or slight movement such as removing one’s khuf, wearing light clothing is also considered slight movements. Likewise, for two moderate steps and two hits. Three or more movements are considered as a lot (and invalidates prayer if it is done consecutively). Whether the movements are from the same type such as three steps or mixed such as one step, one hit and one movement of removing one’s slippers or three steps but one move in one huge step. If he moves in one motion but with the intention of three times movement, then his prayer is invalid.” 
Whereas Imam al-Nawawi explained: “Simplifying what is stated by our ashab regarding the movement not considered as a part of prayer, if it is a lot then the prayer is invalid without any khilaf (on this matter). If the movement is a little, then it doesn’t invalidate prayer.”
He further added: “As for what is considered by people like a lot of movements such as a person’s steps and a lot of consecutive movements, then his prayer is invalid. Our ashab stated: On this principle, then one movement, for instance, one step and hit are small movements and movements of three times is a lot.” 
Hence, three successive movements are a movement that invalidates prayer. As for a movement done twice, such as the situation of the questioner, it has been explained by scholars. In short, it is considered a small movement that doesn’t invalidate the prayer.
Imam al-Nawawi said: “regarding two movements, there are two wajah (opinions). It is said by the author (al-Syirazi) and the Ashab. The most asah is that two times movements are considered a little. And this is the opinion of Syeikh Abu Hamid. The second (opinion) states that two times movement is considered a lot and invalidates prayer if it is done in succession. If the movements are performed after some time, such as a person takes a step then pauses before taking another step or moves twice and stayed still then takes two steps. So, we state: two steps don’t affect prayer and even if it is repeated a hundred times if it isn’t done consecutively, then it doesn’t harm (the prayer) without khilaf. The same for the ruling of hitting repeatedly but not consecutively.” 
However, the two times movements will invalidate prayer if:
- The movements are performed as a joke.
- Excessive movements.
- If he set the intention to move thrice, for he has started qasad to move more than three times.
Imam al-Nawawi stated: “A little movement that doesn’t invalidate prayer (when performed in prayer) is makruh except in several conditions:
- It is done while he forgets
- It is done because of a necessity
- A movement that is considered mandub such as killing a snake, scorpion or others.
To conclude, we state that movements you did when praying in a crane tower where you take two steps backwards to prostrate and two steps forward to stand doesn’t invalidate the prayer. The only advice we have is to try and find a wider space so that you can pray comfortably. If the situation doesn’t permit, then it’s fine.
 See al-Majmu’ Syarh al-Muhazzab, 3/3
 Narrated by al-Baihaqi in Syu’ab al-Iman (2550)
 See Mughni al-Muhtaj, 1/297
 See al-Tanbih Fi al-Fiqh al-Syafie, pg. 76
 See al-Iqna’ Fi Hill al-Alfaz Abi Syuja’, 2/268
 See al-Majmu’ Syarh al-Muhazzab, 4/25-26
 See al-Majmu’ Syarh al-Muhazab, 4/26