All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah and that Muhammad is His slave and Messenger.
Cave Thawr is the cave in which the Prophet and Abu Bakr sought refuge at the start of their Hijrah (migration) to Madeenah to avoid the harm of the disbelievers of Quraysh. The story is too long to be detailed in the answer. However, we shall quote part of the account written by Al-Mubaarakfoori in Ar-Raheeq Al-Makhtoom due to its clarity:
"The Messenger of Allaah left his house on the night of Safar, 27th, in the fourteenth year of Prophethood, meaning 12/13 September 622 A.D. He went to the house of his companion - and the one he trusts most with his company and property - Abu Bakr . They both left Abu Bakr's house from a back door to depart from Makkah in a hurry before dawn. Knowing that Quraysh would mobilize all its potentials to find him, the Prophet played a clever trick on them and instead of taking the road to Madeenah in the north of Makkah as the polytheists would expect, he walked along a road in the opposite direction south of Makkah and leading to Yemen. He walked for five miles until he reached a rough rocky mountain called Thawr. There, his shoes were worn out, some said that he was walking tiptoe in order not to leave a trail behind him. Abu Bakr carried him up the mountain to a cave that became known in history as cave of Thawr. When they reached the cave, Abu Bakr said, 'By Allaah, you will not enter until I have entered before you, lest there is something harmful inside so it would affect me and not you.' So he went in and cleaned it and found a hole in its side. He tore off part of his waist garment and plugged the hole with it. There were two more holes; so he plugged them with his feet. Then he said to the Messenger of Allaah, 'Come in.' The Messenger of Allaah came and laid his head in Abu Bakr’s lap and fell asleep. Suddenly, Abu Bakr’s foot was stung. He didn't move lest he would wake the Prophet up, but it hurt so much that his tears fell on the Prophet’s face. The Prophet asked him what was wrong, so he said, 'I was stung, may my mother and father be sacrificed for you.' The Prophet applied his saliva on Abu Bakr’s foot and the pain immediately disappeared. They confined themselves to this cave for three nights, Friday, Saturday and Sunday. ʻAbdullaah, the son of Abu Bakr, would go see them after dusk, stay the night there, apprise them of the latest situation in Makkah, and then leave in the early morning to mix with the Makkans as usual ... (ʻAamir ibn Fuhayrah, while in the company of other shepherds of Makkah tending his master's, Abu Bakr, flock, used to steal away unobserved every evening with a few goats to the cave and furnish its inmates with a plentiful supply of milk. Quraysh, on the other hand, were quite baffled and exasperated when the news of the escape of the two companions was confirmed.) The notables of Makkah convened an emergency session to determine the future course of action and explore all areas that could help arrest the two men. They decided to block all roads leading out of Makkah and imposed heavy armed surveillance over all potential exits. A reward of 100 camels was set for each of them, dead or alive. Horsemen, infantry and trackers scoured the country. Once, they even reached the mouth of the cave where the Prophet and Abu Bakr were hiding. When he saw the enemy at a very close distance, Abu Bakr whispered to the Prophet 'What, if they were to look through the crevice and detect us?' The Prophet in his God-inspired calm replied, 'O Abu Bakr! What do you think of two whose Third is Allaah.' Anas narrated that Abu Bakr said, 'I said to the Prophet while I was in the cave, 'If any of them should look under his feet, he would see us.' He said, 'O Abu Bakr! What do you think of two (persons) the third of whom is Allaah?'' [Al-Bukhari] It was indeed a divine miracle; the chasers turned back and left when they were only a few steps from the cave..." [Ar-Raheeq Al-Makhtoom]
Allaah knows best.