Updated: Nov 14, 2021
Your Intention and Purpose
Migration, like anything else, is in the first instance a matter of intention, for the Prophet (peace be upon him) said: "Indeed actions are but by intention, and each will be rewarded according to his intent. So whose goal is to migrate for Allah and His Messenger, his migration is for Allah and His Messenger, and whose aim is to migrate to some worldly gain or to take the hand of a woman in marriage, his migration is to that which he has sought."
Migration from the lands of disbelievers to the lands of Muslims was mandatory in the time of the Prophet (peace be upon him), and it is still obligatory till the Day of Judgement. The obligation which the Prophet (peace be upon him) lifted after the conquest of Makkah was that of taking up residence near him. Whoever accepts Islam while living among those who are at war with Muslims must leave to make his home among the Muslims. 
Upon whom it is obligatory and why
1. Mujaashi' Ibn Mas'ud said: "I took my brother to the Prophet after the Conquest of Makkah, and said, "0 Allah's Apostle! I have come to you with my brother so that you may take a pledge of allegiance from him for migration." The Prophet (peace be upon him) said, "The people of migration (i.e. those who migrated to Madinah before the Conquest) enjoyed the privileges of migration (i.e. there is no need for migration anymore)." I said to the Prophet (peace be upon him), "For what will you take his pledge of allegiance?" The Prophet (peace be upon him) said, "I will take his pledge of allegiance for Islam, Belief, and for Jihad” 
2. It is obligatory to leave the lands of the Bidah(innovation). Imam Malik said: "None of you may remain in a country where the Companions are cursed' .
3. It is obligatory to leave a place where forbidden practices are rife since it is mandatory for Muslims to demand observance of the Law . In this regard, Ibn Taymiyyah said, "The state of a place reflects the state of a person. It is possible to be sometimes a Muslim and at other times a disbeliever; sometimes sincere and at other times hypocritical; sometimes good and pious and at other times rotten and corrupt. Thus, a person becomes like the place of his abode. The migration of a person from a land of disbelief and profanity to one of faith and probity is an expression of repentance and of his turning away from disobedience and perversion to belief and obedience. This is so until the Day of Resurrection."
4. One must flee persecution and oppression. This is to be counted as one of the many blessings of Allah swt that he has given His license, to whoever fears for himself and his own safety, to go and find some sanctuary for himself. The first to do this was Abraham,~ who, when he was threatened by his own people said: (1 will emigrate for the sake of my Lord), (29:26), and, (1 am going to my Lord, He shall guide me), (37:99). Then there was Moses: (So he escaped from there, vigilant and fearing for his life, and said "My Lord deliver me from these oppressors" ), (28:21 ).
5. In times of epidemic, people were required to leave the city and remain in the hinterland until the threat of disease had passed. The exception to this is in times of plague. 
6. If one fears for the safety of his family or the security of his property then he must also flee since security of one's possessions is like the safety of one's person. 
Oh Allah please accept my hijrah and expiate my sins, ameen!
 "Sahih al-Bukhari", "The Book o Bad'al-Wahy", Vol.1/9, Hadith 1, and "Sahih Muslim", "The Book of al-Imaara", Vol.3/1515, Hadith 1907.
 an-Nawawi's "Sharh Muslim", Vol. 13/8, and "Ta/sir al-Qurtubi" Vol.5/308.
 "Sahih Al-Bukhari", "The Book of Jihad', 6/189, Hadith 3079
 Ibn al-Arabi, "Ahkaam al-Qur'an", Vol. 1/484-485.
 Ibn al-Arabi, "Ahkaam al-Qur'an", Vol. 1/484-485
 “Majmu'al-Fatawa", 18/284
 Ibn al-Arabi, "Ahkaam al-Qur'an", Vol. 1/485. ESS USW
 "Sahih al-Bukhari", "The Book of at-Tib", Vol.10/142, Hadith :5686, and "Sahih Muslim”, The Book of al-Qisama", Vol.3/1296, Hadith 1271. For the Hadith of plague, see: “Sahih al-Bukhari", "The Book of at-Tib", Vol. 10/179, Hadith 5728, and Muslim "The Book of as-Salam", Vol.4/1741, Hadith 2219.
 Ibn al-Arabi, "Ahkaam al-Qur'an", Vol. 1/486.