The start of the Hijra: departure to the Cave of Thawr
The Prophet ﷺ and his companion Abu Bakr al-Siddiq (may Allah be pleased with him) left Makkah secretly after Allah permitted the migration. They hid in the Cave of Thawr for three nights while Quraysh searched for them, then took the coastal road to Madinah.
When Quraysh's persecution intensified and the assembly of Dar al-Nadwa plotted to kill the Prophet ﷺ — with a youth from every clan striking him a single blow together — Allah permitted him to migrate. He came to Abu Bakr at midday, veiled, and said: "I have been given permission to depart."
ʿAli ibn Abi Talib slept in the Prophet's ﷺ bed to mislead those lying in wait and to return the trusts to their owners. He ﷺ and Abu Bakr left through a small window in Abu Bakr's house toward the Cave of Thawr south of Makkah — the opposite direction to Madinah — and stayed there three nights.
Such was Allah's gentleness that the pagans stood at the mouth of the cave. Abu Bakr said: O Messenger of Allah, if one of them looked beneath his feet he would see us. He ﷺ said: "O Abu Bakr, what do you think of two whose third is Allah?" And Allah revealed: "Do not grieve; indeed Allah is with us."
Note — differing reports on the date: It is well known that he ﷺ left Makkah in late Safar or the beginning of Rabiʿ al-Awwal of year 1; the reports differ on fixing the exact night.