Al-Baqarah - 2:239

فَإنْ خِفْتُمْ فَرِجَالاً أَوْ رُكْبَانًا فَإِذَا أَمِنتُمْ فَاذْكُرُواْ اللّهَ كَمَا عَلَّمَكُم مَّا لَمْ تَكُونُواْ تَعْلَمُونَ
[2:239]
But if you are in danger, then (say your prayers) on foot or on horseback; and when you are secure, then remember Allah, as. He has taught you what you did not know.
If ye fear (an enemy), pray on foot, or riding, (as may be most convenient), but when ye are in security, celebrate Allah's praises in the manner He has taught you, which ye knew not (before).
And if ye go in fear, then (pray) standing or on horseback. And when ye are again in safety, remember Allah, as He hath taught you that which (heretofore) ye knew not.