وَإِذِ اعْتَزَلْتُمُوهُمْ وَمَا يَعْبُدُونَ إِلاَّ اللَّهَ
And when you withdraw from them, and that which they worship, except Allah,
meaning, when you depart from them and follow a different religion, opposing their worship of others besides Allah, then separate from them in a physical sense too,
فَأْوُوا إِلَى الْكَهْفِ يَنشُرْ لَكُمْ رَبُّكُم مِّن رَّحمته
then seek refuge in the cave; your Lord will open a way for you from His mercy,
meaning, He will bestow His mercy upon you, by which He will conceal you from your people.
ويُهَيِّيْ لَكُم مِّنْ أَمْرِكُم مِّرْفَقًا
and will make easy for you your affair.
means, He will give you what you need. So they left and fled to the cave where they sought refuge.
Then their people noticed they were missing, and the king looked for them, and it was said when he could not find them that Allah concealed them from him so that he could not find any trace of them or any information about them.
As Allah concealed His Prophet Muhammad and his Companion (Abu Bakr) As-Siddiq, when they sought refuge in the cave of Thawr. The Quraysh idolators came in pursuit, but they did not find him even though they passed right by him. When the Messenger of Allah noticed that As-Siddiq was anxious and said, "O Messenger of Allah, if one of them looks down at the place of his feet, he will see us,"
he told him;
يَا أَبَا بَكْرٍ مَا ظَنُّكَ بِاثْنَيْنِ اللهُ ثَالِثُهُمَا
O Abu Bakr, what do you think of two who have Allah as their third?
And Allah said;
إِلاَّ تَنصُرُوهُ فَقَدْ نَصَرَهُ اللَّهُ إِذْ أَخْرَجَهُ الَّذِينَ كَفَرُواْ ثَانِيَ اثْنَيْنِ إِذْ هُمَا فِى الْغَارِ إِذْ يَقُولُ لِصَاحِبِهِ لَا تَحْزَنْ إِنَّ اللَّهَ مَعَنَا
فَأَنزَلَ اللَّهُ سَكِينَتَهُ عَلَيْهِ وَأَيَّدَهُ بِجُنُودٍ لَّمْ تَرَوْهَا وَجَعَلَ كَلِمَةَ الَّذِينَ كَفَرُواْ السُّفْلَى وَكَلِمَةُ اللَّهِ هِىَ الْعُلْيَا وَاللَّهُ عَزِيزٌ حَكِيمٌ
If you help him not, for Allah did indeed help him when the disbelievers drove him out, the second of the two; when they were in the cave, he said to his companion;"Do not grieve, surely, Allah is with us."
Then Allah sent down His tranquility upon him, and strengthened him with forces which you saw not, and made the word of those who disbelieved the lower, while the Word of Allah became the higher; and Allah is All-Mighty, All-Wise. (9;40)
The story of this cave (Thawr) is far greater and more wondrous than that of the people of the Cave