Hare Krishna Rex Prabhu. Please accept my humble obeisance’s. All glories to Srila Prabhupada.
I have found that Srila Prabhupada explains how Gajendra could pray to the lord while in the body of the animal. Here is the text.
एवं व्यवसितो बुद्ध्या समाधाय मनो हृदि ।
जजाप परमं जाप्यं प्राग्जन्मन्यनुशिक्षितम् ॥ १ ॥
evaṁ vyavasito buddhyā
samādhāya mano hṛdi
jajāpa paramaṁ jāpyaṁ
śrī-bādarāyaṇiḥ uvāca — Śrī Śukadeva Gosvāmī said; evam — thus; vyavasitaḥ — fixed; buddhyā — by intelligence; samādhāya — for concentration; manaḥ — the mind; hṛdi — in consciousness or in the heart; jajāpa — he chanted; paramam — a supreme; jāpyam — mantra he had learned from great devotees; prāk-janmani — in his previous birth; anuśikṣitam — practiced.
Śrī Śukadeva Gosvāmī continued: Thereafter, the King of the elephants, Gajendra, fixed his mind in his heart with perfect intelligence and chanted a mantra which he had learned in his previous birth as Indradyumna and which he remembered by the grace of Kṛṣṇa.
Such remembrance is described in Bhagavad-gītā (6.43-44):
tatra taṁ buddhi-saṁyogaṁ
yatate ca tato bhūyaḥ
hriyate hy avaśo ’pi saḥ
In these verses it is assured that even if a person engaged in devotional service falls down, he is not degraded, but is placed in a position in which he will in due course of time remember the Supreme Personality of Godhead. As explained later, Gajendra was formerly King Indradyumna, and somehow or other in his next life he became King of the elephants. Now Gajendra was in danger, and although he was in a body other than that of a human being, he remembered the stotra he had chanted in his previous life. Yatate ca tato bhūyaḥ saṁsiddhau kuru-nandana. To enable one to achieve perfection, Kṛṣṇa gives one the chance to remember Him again. This is proved here, for although the King of the elephants, Gajendra, was put in danger, this was a chance for him to remember his previous devotional activities so that he could immediately be rescued by the Supreme Personality of Godhead.
It is imperative, therefore, that all devotees in Kṛṣṇa consciousness practice chanting some mantra. Certainly one should chant the Hare Kṛṣṇa mantra, which is the mahā-mantra, or great mantra, and also one should practice chanting cintāmaṇi-prakara-sadmasu or the Nṛsiṁha strotra (ito nṛsiṁhaḥ parato nṛsiṁho yato yato yāmi tato nṛsiṁhaḥ). Every devotee should practice in order to chant some mantra perfectly so that even though he may be imperfect in spiritual consciousness in this life, in his next life he will not forget Kṛṣṇa consciousness, even if he becomes an animal. Of course, a devotee should try to perfect his Kṛṣṇa consciousness in this life, for simply by understanding Kṛṣṇa and His instructions, after giving up this body one can return home, back to Godhead. Even if there is some falldown, practice of Kṛṣṇa consciousness never goes in vain. For example, Ajāmila, in his boyhood, practiced chanting the name of Nārāyaṇa under the direction of his father, but later, in his youth, he fell down and became a drunkard, woman-hunter, rogue and thief. Nonetheless, because of chanting the name of Nārāyaṇa for the purpose of calling his son, whom he had named Nārāyaṇa, he became advanced, even though he was involved in sinful activities. Therefore, we should not forget the chanting of the Hare Kṛṣṇa mantra under any circumstances. It will help us in the greatest danger, as we find in the life of Gajendra.
I hope this was helpful. Your servant, Bhakta David.