In 622, on the invitation of the Muslims of Medina, Muhammad ordered Muslims to migrate to Medina. The migration began in batches. Ali was the last to remain in Mecca, entrusted with responsibility for settling any loans the Muslims had taken out, and famously slept in the bed of Muhammad when the Quraysh, led by Ikrima, attempted to murder Muhammad as he slept. Meanwhile, Abu Bakr accompanied Muhammad to Medina. Due to the danger posed by the Quraysh, they did not take the road, but moved in the opposite direction, taking refuge in a cave in Jabal Thawr, some five miles south of Mecca. Abd Allah ibn Abi Bakr, the son of Abu Bakr, would listen to the plans and discussions of the Quraysh, and at night he would carry the news to the fugitives in the cave. Asma bint Abi Bakr, the daughter of Abu Bakr, brought them meals every day.Islamic Culture by the Islamic Cultural Board Published 1927 s.n. Original from the University of Michigan, digitized 27 March 2006. Aamir, a servant of Abu Bakr, would bring a flock of goats to the mouth of the cave every night, where they were milked. The Quraysh sent search parties in all directions. One party came close to the entrance to the cave, but was unable to see them. Abu Bakr was referenced in the Qur'an in verse 40 of : "If ye help him not, still God helped him when those who disbelieve drove him forth, the (second of the two i.e. Abu Bakr); when they two were in the cave, when he said unto his (companion i.e. Abu Bakr). Aisha, Abu Saʽid al-Khudri and Abd Allah ibn Abbas in interpreting this verse said that Abu Bakr was the companion who stayed with Muhammad in the cave.
In 622 on the invitation of the Muslims of Medina Muhammad ordered Muslims to migrate to Medina The migration began in batches Ali was the last to remain in Mecca entrusted with responsibility for settling any loans the Muslims had taken out and famously slept in the bed of Muhammad when the Quraysh led by Ikrima attempted to murder Muhammad as he slept Meanwhile Abu Bakr accompanied Muhammad to Medina Due to the danger posed by the Quraysh they did not take the road but moved in the opposite direction taking refuge in a cave in Jabal Thawr some five miles south of Mecca Abd Allah ibn Abi Bakr the son of Abu Bakr would listen to the plans and discussions of the Quraysh and at night he would carry the news to the fugitives in the cave Asma bint Abi Bakr the daughter of Abu Bakr brought them meals every dayIslamic Culture by the Islamic Cultural Board Published 1927 sn Original from the University of Michigan digitized 27 March 2006 Aamir a servant of Abu Bakr would bring a flock of goats to the mouth of the cave every night where they were milked The Quraysh sent search parties in all directions One party came close to the entrance to the cave but was unable to see them Abu Bakr was referenced in the Qur'an in verse 40 of  "If ye help him not still God helped him when those who disbelieve drove him forth the (second of the two ie Abu Bakr); when they two were in the cave when he said unto his (companion ie Abu Bakr) Aisha Abu Saʽid al-Khudri and Abd Allah ibn Abbas in interpreting this verse said that Abu Bakr was the companion who stayed with Muhammad in the cave