Q. The Halacha is that a person for whom Torah study is his occupation, he is exempt from prayer. An example of such a person is Rashbi [Rabbi Shimon bar Yochai]. And, yet, the Gemara in Shabbos tells us that although Rashbi would learn with his son the whole day when they were hiding from the wicked Romans, when the time for prayer came they would get dressed and pray. The question is, why did they pray if they were exempt from this mitzvah?
Perhaps the Rav could provide some insight.

A. Your question is asked by Tosafos (Shabbat 11a – d’h. Kegon,) his answer is that they were indeed exempt from tefila but not from krias shema, (Shulchan Aruch O.H. 106: 2) and they halted their learning for the reading of shema.
Tosafos answer is challenged by Gilyon Hashas and Tzlach (ibid.) from Tosafos (Brachot 15a dh. Aman) who maintains that the word “matzlei” does not mean reciting shema. Various Mefarshim explain that Tosafos in Shabbat refers to Shacharis that is preceded by the shema reading. Once they stopped for shema they would include the tefila too. However, they would not interrupt their learning for tefilas Mincha.
Hagohos Habach (ibid.) following the opinion of the Tur explains, that although Rav Shimon Bar Yochai was not obligated to stop learning Torah in order to pray, if he wanted to he would be allowed.
Horav Shlomo Miller Shlit’a added that they would not engage in every day tefila and pleading for their own private needs, but they would implore and pray for the needs of others or K’lal Yisroel in special tefilos.

Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit”a