Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:36:67

And if We willed, We could have deformed them, ˹paralyzing them˺ in their places so they would not be able to proceed, nor could they return.  

And had We willed We would have transformed them, ˹into˺ apes or swine or stones, in their place (makānatihim, variant reading has makānātihim, the plural of makāna, meaning makān, in other words ‘in their dwellings’); then they would have neither been able to go ahead nor to return, in other words, they would not then be able to come and go.
القرآن:٣٦:٦٧

وَلَوْ نَشَاءُ لَمَسَخْنَاهُمْ عَلَىٰ مَكَانَتِهِمْ فَمَا اسْتَطَاعُوا مُضِيًّا وَلَا يَرْجِعُونَ  

{ولو نشاء لمسخناهم} قردة وخنازير أو حجارة {على مكانتهم} وفي قراءة مكاناتهم جمع مكانة بمعنى مكان أي في منازلهم {فما استطاعوا مضيا ولا يرجعون} أي لم يقدروا على ذهاب ولا مجيء.