And We bound [i.e., made firm] their hearts when they stood up and said, "Our Lord is the Lord of the heavens and the earth. Never will we invoke besides Him any deity. We would have certainly spoken, then, an excessive transgression.
Their Belief in Allah and their Retreat from their People
From here Allah begins to explain the story in detail. He states that they were boys or young men, and that they were more accepting of the truth and more guided than the elders who had become stubbornly set in their ways and clung to the religion of falsehood. For the same reason, most of those who responded to Allah and His Messenger were young people. As for the elders of Quraysh, most of them kept to their religion and only a few of them became Muslims. So Allah tells us that the people of the cave were young men. Mujahid said, "I was informed that some of them wore some kind of earrings, then Allah guided them and inspired them to fear Him, so they recognized His Oneness, and bore witness that there is no god besides Him."
The first sentence of verse 14: وَرَبَطْنَا عَلَىٰ قُلُوبِهِمْ (And We made their hearts firm) refers to the event described by Ibn Kathir a little earlier. This tells us that Allah made the hearts of these people firm when the king who was cruel and worshipped idols summoned them in his court and questioned them. This was a matter of life and death. But, despite their apprehension for the worst, Allah Ta` ala made His love, awe and grandeur prevail over their hearts which empowered them to face any eventuality of death or distress. The outcome was that they proclaimed their belief clearly and courageously saying that they did not worship anyone or anything other than Allah and would not do that in future as well. People who firmly resolve to do something for the sake of Allah, this is how they receive help from Allah Ta’ ala.
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 9–14
The incident of the Men of the Cave shows symbolically the stages through which true believers have to pass in their lives and the hurdles which they have to surmount. We learn from this incident that true believers sometimes, by force of circumstances, are compelled to take refuge in a ‘cave’. But, from this cave which, to all appearances, was a grave for them, emerged a flood of life and vitality. Where their opponents had planned to end the lives of these young men, a new history began for them from that very same place. If the Men of the Cave are the same individuals known as the Seven Sleepers in Christian history, the story relates to the city of Ephesus. This once famous city, dating back to ancient times, was situated on the west coast of Turkey, where its majestic ruins can still be seen today. During the period 249 to 251 A.D., this area was under the rule of a Roman ruler, Desius. Polytheism was prevalent here and the moon was treated as a god and worshipped. During this period, the message of the Unity of God (monotheism) reached this area through the early followers of Jesus Christ and started spreading. The Roman ruler of this place, who was a pagan, could not tolerate the spread of this monotheistic religion and started persecuting the followers of Jesus Christ. The aforesaid ‘Men of the Cave’ were seven young men from noble families of Ephesus, who embraced the monotheistic religion probably in the year 250 A.D. and who became preachers of that religion. When they were harassed by the authorities, they fled the city and took refuge in a big cave on the side of a nearby mountain.