“When was Al-Hijrah (Migration) legislated, and what were the types of hijrah in the era of the Prophet (Sallallaahu ‘alayhi wa Sallam)?”
The hijrah of the Muslims from Makkah to Al-Habasha (in Ethiopia), which is the first hijrah, took place in the month of Rajab five years after the mab’ath (the time when the Prophet (Sallallaahu ‘Alayhi Wa ‘Alaa Aalihi Wa Sallam) was sent with Islaam) as the historians mention. As for the hijrah of the Prophet (Sallallaahu ‘Alayhi Wa Sallam) from Makkah to Madeenah, it took place in the month of Rabee’ Al-Awwal thirteen years after being sent.
As for the types of hijrah which existed in the era of the Prophet (Sallallaahu ‘Alayhi Wa Sallam), a group of Scholars have mentioned various types of hijrahs to the point that some of them mentioned eight types, however, some of these types are not accepted as being called hijrah, rather they are delegations.
Whatever the case may be, the hijrahs that occurred in Islaam and have the right to be called hijrah are of two forms:
1. Moving from the land of fear to the land of safety, as occurred in the two hijrahs to Al-Habasha, for verily Al-Habasha was a land of disbelief, but it was safe and secure for the Muslims in comparison to Makkah, and likewise in the beginning of the hijrah from Makkah to Madeenah, for verily Madeenah at first was a land of disbelief, but it was safe and secure for the Muslims.
2. The hijrah from the land of disbelief to the land of belief. That occurred after the Prophet (Sallallaahu ‘Alayhi Wa Sallam) took residence in Madeenah, and those Muslims who were able to, made hijrah to it. Al-Hijrah at that time was only relevant to moving to Madeenah, until Makkah was conquered. The specific ruling then ceased, while the general ruling of leaving the land of disbelief for whoever was able to do so remained.
Source : Questions and answers concerning al-Hijrah – By Shaykh ‘Abdur Rahmaan al-‘Adanee