Hadith.857 - Imam عليه السلام said to Zurarah:
"The prayer is not to be repeated except for five things: purification (taharah), time (observing the prayer time), facing the Qiblah, bowing (ruku'), and prostration (Sujood)”.
My father, may Allah سبحانه وتعالى be pleased with him, said in his letter to me:
"If you want to perform a supererogatory (nafl) prayer while riding, pray and turn the head of your mount in whatever direction it faces, whether toward the Qiblah or otherwise, right or left. If you pray a mandatory (fardh) prayer while on the back of your mount, face the Qiblah, say the opening takbir (Allahu Akbar), and then proceed in whichever direction your mount takes you, reciting. When you wish to bow and prostrate, bow and prostrate on something you have with you that is permissible to prostrate upon. Do not pray a mandatory prayer in this manner unless there is a severe necessity. If you are walking, follow the same procedure, but when you wish to prostrate, you must prostrate on the ground."
The letter also stated : "If a wild animal approaches and you fear missing the prayer, face the Qiblah and pray using gestures. If you fear the animal and it continues to circle you, move with it as it moves and pray using gestures."