We learn that the background for these verses is that they were revealed after the battle of Uhud. Any time after the battle of Uhud. Mawdudi, Tafsir al-Jalalayn and Maulana Muhammed Ali, agree that these verses were revealed after Uhud. Tafsir al-Jalalayn and Mawdudi  go even more specific, saying that the verses on ‘fear prayer’ were revealed concerning an incident that occurred at Dhat al-Riqa (or Batn Nakhla). This expedition took place as a result of Banu Ghatafan tribe (and other tribes), who were assembling troops to attack the Muslim community. In return, the Prophet (p) and his companions set out to engage the hostile enemy. Read more about this expedition in the following article: Expedition of Dhat al-Riqa.
4:100 And whoever emigrates for the cause of Allah will find on the earth many [alternative] locations and abundance. And whoever leaves his home as an emigrant to Allah and His Messenger and then death overtakes him – his reward has already become incumbent upon Allah . And Allah is ever Forgiving and Merciful.
4:101 And when you travel throughout the land, there is no blame upon you for shortening the prayer, [especially] if you fear that those who disbelieve may disrupt [or attack] you. Indeed, the disbelievers are ever to you a clear enemy.
4:102 And when you are among them and lead them in prayer, let a group of them stand [in prayer] with you and let them carry their arms. And when they have prostrated, let them be [in position] behind you and have the other group come forward which has not [yet] prayed and let them pray with you, taking precaution and carrying their arms. Those who disbelieve wish that you would neglect your weapons and your baggage so they could come down upon you in one [single] attack. But there is no blame upon you, if you are troubled by rain or are ill, for putting down your arms, but take precaution. Indeed, Allah has prepared for the disbelievers a humiliating punishment.
4:103 And when you have completed the prayer, remember Allah standing, sitting, or [lying] on your sides. But when you become secure, re-establish [regular] prayer. Indeed, prayer has been decreed upon the believers a decree of specified times.
4:100 Speaks about those Muslims who were left behind in Makkah, and are told if they leave such place to ‘emigrate’ away, and death ‘overtakes’ the person that a massive reward will be awaiting. The verse refers to those Muslims who lived in hostile places such as Makkah which they have no excuse to stay there. That they have to leave such places.
In 4:101 it speaks about those Muslims who were travelling in Arabia, but feared sometimes praying because the enemies were out there trying to kill Muslims. Hence, here God Almighty instructs the Muslims that if they’re in situation, where there is imminent threat of attack to their lives, then they can shorten their prayers. When they reach a place of safety they can resume normal prayers. There is an authentic report (Hadith) that speaks about this verse:
“It was narrated that Ya’la bin Umayyah said: “I asked ‘Umar bin Khattab: ‘Allah says: “And when you travel in the land, there is no sin on you if you shorten the prayer if you fear that the disbelievers may put you in trial (attack you), verily, the disbelievers are ever to you open enemies,” [4:101] but now there is security and people are safe.’ He said: ‘I found it strange just as you do, so I asked the Messenger of Allah about that, and he said: “It is charity that Allah has bestowed upon you, so accept His charity.” (Sunan Ibn Majah volume 1, Book 5, Hadith 1065)
As we see, this verse specifically speaks about times where the Muslims 1400 years ago weren’t safe, and were about to be attacked, and hence they were allowed to shorten their prayer.
This verse (Q. 4:102) and the previous already shown, tells us that salat (prayer) in Islam is very important. No one can neglect it even if they were facing the enemy. When we read this present verse (Q. 4:102), we see that this prayer refers to those Muslims who were actively facing an enemy, not far off from them. The words such as that the ‘disbelievers’ were waiting for the Muslims at the time to put away their weapons away so the enemy attacks, shows that the verse was directly refers to a battle the Muslims were involved in, 1400 years ago.
Quran 4:103 then tells Muslims then, when they have completed their prayer, that they should be remembering God, ‘standing’, ‘sitting’ or when they are lying. When they’re away from the enemies, in a safe and secure environment they should resume their normal prayers.
Malik Ghulam Farid:
“658. Islam accepts no excuse from believers to stay in environments hostile to their Faith if they can afford to leave such localities.
659. The subject of prayers in time of fear has been dealt with in the Qur’an in three separate verses, viz., (1) in 2:240 which deals with prayers performed in time of extreme fear when no formal prayer is possible; (2) in the present verse which deals with prayers performed individually in time of ordinary fear; and (3) in the following verse which deals with prayers performed in congregation in time of fear. The ‘shortening of prayer’ as mentioned in the present verse, which relates to the saying of prayers individually, does not here signify the lessening of the number of Rak’ats which has from the very beginning been fixed at two in a state of journey. It only signifies the saying of the prescribed prayers quickly when there is danger of an attack from the enemy. The number of Rak’ats to be said when a man is on a journey has ever been two; but in time of danger when one has to say one’s prayers individually, even these two rak’ats may be gone through quickly (Kathir). This view is endorsed by Mujahid, Dahhak, and Bukhari (ch. On salat al-khauf). …
661. The verse observes a difference between Aslihah (arms) and Hidhr (precautions). Whereas the former may be put aside in moments of comparative security, the latter should never be neglected.
662. As in the midst of a battle formal prayers are either said in haste, or performed in the form of one Rak’at, Muslims are enjoined in this verse, that in order to make up the deficiency, they should remember God and pray to Him in an informal manner after the obligatory service is over. This is to compensate for the shortening of prayer.” 
Maulana Muhammad Ali:
“101a. It is agreed that the prayer service on a journey is shorter than the ordinary prayer service in the ˚ u h r, ‘asr and isha’ prayers and consists of two rak‘ahs far˙ instead of four. It is further clear from reports that this was so before the revelation of this verse.
According to A’ishah, prayer as instituted from the first consisted of two rak‘ahs only, whether one was journeying or not, and later on ordinary service in these three prayers was increased to four (B. 8:1). According to I‘Ab, prayer as enjoined from the first consisted of four rak‘ahs in these three prayers ordinarily, and two rak‘ahs when journeying (Ms. 6:5). According to both these views, the shortening of prayer as mentioned in this verse is quite different from the ordinary shorter service of the journey, and its details are given in the next verse. According to ‘Umar, however, the shortening on a journey was a result of the revelation of this verse, and though originally this shortening was allowed only when there was danger from the enemy, it was later on allowed on every journey, whether there was any danger or not. When a question was put to him why prayer was being shortened on a journey when there was no longer any danger, there being peace all around, he replied that he put the same question to the Prophet of God and was told that the shortening “was a sadaqah (or charitable gift) of God, so accept His gift” (AD. 4:1)
102a. This verse and the previous one show the importance of prayer in Islam, which could not be neglected even when facing the enemy. The soldiers of Islam were not men with whom fighting was a primary occupation; the chief object of their lives, as these verses show, was to hold communion with the Diving Being, forgetting even their imminent danger, when the time of holding such communion arrived.
According to what is stated in this verse, the congregation performed only one rak‘ah of prayer with the Prophet who was leading the prayer and said two rak‘ahs, but we are told in a hadith that the other rak‘ah was said by each part of the congregation separately (B. 12:1). This shows the importance of offering prayer in congregation which could not be neglected even on the field of battle.
103a. By kitab mauqut, or a timed ordinance, is meant an ordinance regulated as to time, or ordained to be performed at fixed times. The hours of prayer were therefore fixed by the Prophet under Divine guidance, and the observance of the hours of prayer is an essential part of the due observance of prayer. It is this feature of the Islamic prayer which makes it a unique force in the unification of the human race.” 
“126 The word muragham is derived from the noun ragham (“dust”) and is connected with the idiomatic expression raghima anfuhu, “his nose was made to cleave to dust”, i.e., he became humbled and forced to do something against his will. Thus, muragham denotes “a road by the taking of which one leaves one’s people against their will” (Zamakhshari), it being understood that this separation from one’s familiar environment involves what is described as muraghamah, the “breaking off (from another)” or the “cutting off from friendly or living communion” (see Lane III, 1113). All this can best be rendered, in the above context, as “a lonely road” – a metaphor of that heart-breaking loneliness which almost always accompanies the first steps of one who sets forth on his “exodus from evil unto God”. (Regarding this latter expression, see note on verse 97 above as well as surah 2, verse 218.)
127 Lit., “the prayer”: a reference to the five obligatory daily prayers – at dawn, noon, afternoon, after sunset and late in the evening – which may be shortened and combined (the noon prayer with that of the afternoon, and the sunset prayer with that of the late evening) if one is travelling or in actual danger. While the extension of this permission to peaceful travel has been authorized by the Prophet’s Sunnah, the Qur’an mentions it only in connection with war situations; and this justifies the interpolation, in the opening sentence, of the words “to war”. The prayer described in the next verse – with the congregation praying in shifts – is called salat al-khawf (“prayer in danger”).
128 Lit., “might cause you an affliction” – implying, according to almost all the commentators, a sudden attack.
129 Lit., “among them”. The “thou” in this sentence refers, primarily, to the Prophet and, by implication, to the leader of every group of believers at war with “those who deny the truth”.
130 Lit., “when they have prostrated themselves, let them [i.e., the other group] be behind you”. This idiomatic expression is not to be taken literally: in classical Arabic usage, the phrase kana min wara ika (lit., “he was behind thee”) signifies “he protected thee” or (in military parlance) “he covered thee”, and is not meant to describe the physical relative position of the two persons or groups.
131 Lit., “turn upon you in one turning”.
132 I.e., if there is a risk of their weapons being damaged by exposure to unfavourable weather conditions, the warriors are exempted from the obligation of keeping their arms with them while praying. This exemption applies, of course, only to such of the soldiers as are in charge of particularly sensitive weapons; and the same applies to the individual cases of illness mentioned in the sequence. It must, however, be remembered that the term matar (lit., “rain”) is often used in the Qur’an to denote “an affliction”: and if we adopt this meaning, the above phrase could be rendered as “if you suffer from an affliction”- thus allowing for a wide range of possible emergencies.” 
Asbab Al-Nuzul by Al-Wahidi:
“(And when thou (O Muhammad) art among them and arrangest (their) worship for them…) [4:102]. … “We performed the prayer of Zuhr with the Messenger of Allah, upon which the idolaters exclaimed: ‘They were in a vulnerable situation, why did we not attack them by surprise?’ Then they said: ‘There shall come another prayer which is more beloved to them than their own fathers, which is the mid-afternoon (‘Asr) prayer’. Gabriel, then came down with these verses between the Zuhr and the ‘Asr prayers. (And when thou (O Muhammad) art among them and arrangest (their) worship for them) in ‘Usfan, while the idolaters were led by Khalid ibn al-Walid; they were between us and the qiblah, and then He mentioned the prayer of fear”. … “The Messenger of Allah, went out and met the idolaters in ‘Usfan. When he performed the Zuhr prayer, and the idolaters saw him bowing and prostrating, they said to each other: ‘This was a missed opportunity for you. If you had raided them then, they would not have felt you coming until you had effectively attacked them’. One of them said: ‘They have another prayer which is more beloved to them than their wives and wealth, so get ready to raid them when they are performing it’. Allah, glorious and majestic is He, then revealed to His Prophet, (And when thou (O Muhammad) art among them and arrangest (their) worship for them) up to the end of the verse, and informed him about the plot of the idolaters and mentioned therein the prayer of fear”. 
Don’t forget to follow Discover The Truth on Facebook and Twitter. PLEASE help spread the word by sharing our articles on your favourite social networks. Thank You!
 “We learn from the Traditions that the Commandment about salat during war time was given on the occasion of Zat-ur-Riqa’a, an expedition which took place in A. H. 4. From this we conclude that the discourse containing v. 102 was revealed on that occasion.” – Mawdudi
 The Holy Qur’an – Arabic Text With English Translation & Short Commentary By Malik Ghulam Farid,
page 212 – 213
 The Holy Quran Arabic Text with English Translation, Commentary and comprehensive Introduction [Year 2002 Edition] by Maulana Muhammad Ali, page 225 – 226
 The Message of The Quran translated and explained by Muhammad Asad, 191 – 193
Click to access The_Message_of_The_Quran__by_Muhammad_Asad.pdf
 Asbab Al-Nuzul by Al-Wahidi http://altafsir.com/Tafasir.asp?tMadhNo=0&tTafsirNo=86&tSoraNo=4&tAyahNo=102&tDisplay=yes&UserProfile=0&LanguageId=2