And if you fear [an enemy, then pray] on foot or riding. But when you are secure, then remember Allāh [in prayer], as He has taught you that which you did not [previously] know.
If you face danger from an enemy or any other danger, and you are not able to offer the prayer completely, then pray whilst walking or riding, on camels, horses, or in any way you can. If the danger has gone, remember Allah as He has taught you: remembering Him in the most complete manner within the prayer. Also, remember Him for His having taught you guidance and given you light which you were previously unaware of.