(And when you forsake them and what they worship save Allah...
(And when you forsake them and what they worship save Allah, betake yourselves for refuge to the cave) your Lord will extend to you largely of His mercy and provide for you a profitable course in your affair. And you might see the sun when it rose from their cave towards the right hand, and when it set behind them on the left while they were in a wide space thereof.
This is of the signs of Allah; Whomsoever Allah guides, he is the rightly guided one, and whomsoever He causes to err, you shall not find for him any friend to lead (him) aright). (12:17) And you might think they are awake while they sleep, and we turned them about to the right and to the left, while their dog lay outstretching its paws at the entrance.
‘Ali ibn Ibrahim has narrated that the said turning makes one think that they are awake and that Allah is turning them so that their sides may not be damaged by the earth (hard rock). ‘Ali ibn Ibrahim says that Allah makes them turn sides twice in a year. If you looked at them you would turn back from them in fright, and you would certainly be filled with awe at their sight (owing to their huge bodies or open eyes or the horrible environment).
Imam al-Baqir has said that these words are not addressed to the holy Prophet but is the description of the awful situation shown to all. And thus did We rouse them that they might question each other. A speaker among them said, How long have you tarried? They said, we have tarried for a day or a part of a day. (Others) said, Your Lord knows best how long you have tarried. Now send one of you with this silver (coin) of yours to the city and let him see which of them has the purest food.
Let him bring you provision from it, and let him behave with gentleness so that by no means is your case known to any one:). ‘Ali ibn Ibrahim has said that here ‘pure food’ means lawful food. For surely, if they prevail against you they would stone you to death or force you back to their religion, and then you will never succeed. And thus did We make (men) to get knowledge of them, that they might know that Allah’s promise is true and that as for the hour there is no doubt about it.
When they disputed among themselves about their affairs and said, Erect an edifice over them -- their Lord best knows them. Those who prevailed in their affair said, We would certainly raise a Masjid over them.