Madinah (Yathrib) was populated with many tribes, but most important were the tribes of Aus and Khazraj. There was also a separate section of Madinah which was dominated by the Jews.
As the thirteenth year of Nubuwwat almost finidhed seventy Muslims, including two women, came to Makkah to perform pilgrimage and to meet Rasulullah at Aqabah. They were specifically sent by the Muslims of Madinah to request Rasulullah to come with them to Madinah.
The determined Muslims pledged on the hand of Rasulullah that they will sacrifice their lives to protect him and Islam, as they would their wives and children. This was the Second Covenant of Aqabah.
Rasulullah chose twelve Muslims of Madinah for the propagation of Islam. Nineof them were from the tribes of Khazraj. After the pledge had been taken, Rasulullah decided to migrate to Madinah. The muslims began to leave Makkah and go to Madinah. There were only a few Muslims left in Makkah and Rasulullah waited for Allah's commad to leave for Madinah.
Contents of the biography of the Prophet Muhammed