Hadith.1335 - Imam عليه السلام said :
"Whoever prays the Maghrib prayer during a situation of fear with a group, he prays one rak'ah with the first group and two rak'ahs with the second group."
And if someone encounters a wild animal and fears missing the prayer, he should face the Qiblah and perform his prayer using gestures. If the wild animal approaches and poses a threat, he should move with it as it moves and continue his prayer using gestures.