People can pray and remember Allah anywhere they wish
Bismillah Irrahma nir Rahim
(Those who have intelligence are) Those who remember Allah, standing, sitting and lying on their sides (They do not forget Allah at any time), and reflect on the creation of the heavens and the earth (so that they may be able to see Allah’s greatness in this). (Then, amazed by Allah creation, they say:
"Our Rabb, You have not created this for nothing! (These things certainly display Your Power and greatness and have not been created in vain) Glory be to You! (none can never be equal to You) So safeguard us from the punishment of the Fire (of Jahannam).
(They pray further, saying) Our Rabb, those You cast into the Fire (to suffer there forever), You have indeed disgraced. The wrongdoers (those who die as Kuffaar) will have no helpers.
Our Rabb, we heard a caller (Rasulullah and the Qur’an) calling us to faith: "Have faith in your Lord!' and we had faith. Our Lord, forgive us our wrong actions, erase our bad (evil) actions from us (so that no one knows about them) and take us back to You with those who are truly good.
Our Rabb, give us what (victory, mercy, supremacy) You promised us through Your Messengers, and do not disgrace us on the Day of Rising (Judgement). Verily You do not break Your promise."
Their Lord responds (accepts their prayer saying) to them:
"I will not let the deeds of any doer among you go to waste, male or female…"
(Surah Al Imran: 191-195)