Migration is the core constitution of Muslim's life; this is the essence of his moral strength!
His life's meaning is to be in constant motion; to leave the dew and to conquer the ocean! [Iqbal]
This is the reality why the Quran has given so much importance to Hijrah, and has explained it in different ways to highlight its essential wisdom. For example:
يَا عِبَادِيَ الَّذِينَ آمَنُوا إِنَّ أَرْضِي وَاسِعَةٌ فَإِيَّايَ فَاعْبُدُونِ
(29:56). O my servants! You acquired IMAN; you trust My Laws; and you have decided to lead life according to them. Hence, if the circumstances are not favorable where you live, then move to a place where you can find a conducive environment for it, because Allah's earth is very vast. The objective is not to stick to any particular place, but to live a life according to the Divine Laws, wherever possible; and to obey Him and none else. Therefore, migrate to a place where it is possible to live such a life.
How wonderfully it is explained in Surah Al-Nisa:
إِنَّ الَّذِينَ تَوَفَّاهُمُ الْمَلَائِكَةُ ظَالِمِي أَنفُسِهِمْ قَالُوا فِيمَ كُنتُمْ ۖ قَالُوا كُنَّا مُسْتَضْعَفِينَ فِي الْأَرْضِ ۚ قَالُوا أَلَمْ تَكُنْ أَرْضُ اللَّـهِ وَاسِعَةً فَتُهَاجِرُوا فِيهَا ۚ فَأُولَـٰئِكَ مَأْوَاهُمْ جَهَنَّمُ ۖ وَسَاءَتْ مَصِيرًا
(4:97) - Hijrah plays a very important role in the life of believers (Momineen). Those who are content to live a wretched and oppressed life in an ungodly society will be asked by the angels (Malaika) at the time of their death: "Why did you lead such a wretched life?" They will answer, "We were weak and helpless." The angels will then say, "Wasn't the earth of Allah vast enough for you to undertake Hijrah to some favorable place?" These people lead a life of Hell (Jahannam) in this world and will lead a life of Hell in the Hereafter as well; and they will abide therein forever, as there is no death in the Hereafter.
Excuse of only those people will be accepted who cannot find a way to migrate because of physical weakness or disability:
إِلَّا الْمُسْتَضْعَفِينَ مِنَ الرِّجَالِ وَالنِّسَاءِ وَالْوِلْدَانِ لَا يَسْتَطِيعُونَ حِيلَةً وَلَا يَهْتَدُونَ سَبِيلًا ; فَأُولَـٰئِكَ عَسَى اللَّـهُ أَن يَعْفُوَ عَنْهُمْ ۚ وَكَانَ اللَّـهُ عَفُوًّا غَفُورًا
(4:98-99) - But excepted shall be the truly helpless - be they men or women or children - who cannot bring forth any strength and have not been shown the right way: For them there is hope for leniency from Allah Who is Forbearing and Protective.
As for those who migrated:
وَمَن يُهَاجِرْ فِي سَبِيلِ اللَّـهِ يَجِدْ فِي الْأَرْضِ مُرَاغَمًا كَثِيرًا وَسَعَةً ۚ وَمَن يَخْرُجْ مِن بَيْتِهِ مُهَاجِرًا إِلَى اللَّـهِ وَرَسُولِهِ ثُمَّ يُدْرِكْهُ الْمَوْتُ فَقَدْ وَقَعَ أَجْرُهُ عَلَى اللَّـهِ ۗ وَكَانَ اللَّـهُ غَفُورًا رَّحِيمًا
(4:100) - Whoever undertakes Hijrah for the cause of Allah will find a place of refuge and plentiful resources! Whoever leaves home to undertake Hijrah to a place where the Quranic Order is established and is overtaken by death on the way, will be fully rewarded by Allah, for Allah is the Protector and the dispenser of grace.
The Quran profusely and repeatedly appreciates those who undertake the journey to migrate to a place where they could establish the divine order and code of life:
إِنَّ الَّذِينَ آمَنُوا وَالَّذِينَ هَاجَرُوا وَجَاهَدُوا فِي سَبِيلِ اللَّـهِ أُولَـٰئِكَ يَرْجُونَ رَحْمَتَ اللَّـهِ ۚ وَاللَّـهُ غَفُورٌ رَّحِيمٌ
(2:218) - Those who believe in the Divine System, who undertake Hijrah, and who struggle hard for the cause of Allah, are the persons who can rightfully expect Allah's Blessings, and which they will receive, for Allah is the Protector and the dispenser of grace.
كَتَبَ اللَّـهُ لَأَغْلِبَنَّ أَنَا وَرُسُلِي ۚ إِنَّ اللَّـهَ قَوِيٌّ عَزِيزٌ
(58:21) - It is Allah's decree (the Law) that in the tussle between good and evil, good will prevail. Allah's Messenger shall ultimately be victorious and successful. This is the decree of Allah, who is Almighty and All-powerful.
It is not possible for any power on earth to defeat truth. Moreover:
وَلَسَوْفَ يُعْطِيكَ رَبُّكَ فَتَرْضَىٰ
(93:5) - And, indeed, in time will your Sustainer grant you what your heart desires, and you shall be well pleased.
But:
وَلَلْآخِرَةُ خَيْرٌ لَّكَ مِنَ الْأُولَىٰ
(93:4) - The initial stage of this program would be difficult, requiring sacrifice, forbearance, and courage. However, ultimately, it will turn out to be a source of blessings; and everything in future will be better than your previous life.
وَإِذْ يَمْكُرُ بِكَ الَّذِينَ كَفَرُوا لِيُثْبِتُوكَ أَوْ يَقْتُلُوكَ أَوْ يُخْرِجُوكَ ۚ وَيَمْكُرُونَ وَيَمْكُرُ اللَّـهُ ۖ وَاللَّـهُ خَيْرُ الْمَاكِرِينَ
(8:30) - O Messenger! Call to mind the occasion when the unbelievers of Makkah plotted against you to detain you as a prisoner or to kill or banish you. They plotted thus but in His turn Allah made His own plans. Allah's plans are the best.
In Surah Al-Tariq it is described:
إِنَّهُمْ يَكِيدُونَ كَيْدًا ; وَأَكِيدُ كَيْدًا ; فَمَهِّلِ الْكَافِرِينَ أَمْهِلْهُمْ رُوَيْدًا
(86:15-17) - These opponents are making plans (to stop this message from spreading); But Our Law is not negligent. It is also busy making its own plans. The question only is that of respite: which is the time between sowing the seed and the sprouting of its verdure. Thus, leave them alone for the time being (to their own doings). They are getting a little respite according to Our Law of Requital. Nevertheless, eventually they will be seized and the Revolution mentioned above will surely come.
إِنَّ الَّذِينَ آمَنُوا وَهَاجَرُوا وَجَاهَدُوا بِأَمْوَالِهِمْ وَأَنفُسِهِمْ فِي سَبِيلِ اللَّـهِ وَالَّذِينَ آوَوا وَّنَصَرُوا أُولَـٰئِكَ بَعْضُهُمْ أَوْلِيَاءُ بَعْضٍ
(8:72) - Those who have believed, have left their homes and have struggled hard with their lives and their wealth in the cause of Allah, and those who have given shelter and help to them - they shall be true friends and protectors of each other.
Ansaars suffered themselves but made sure their brothers-in-faith did not. This is the special quality of believers that the Quran describes thus:
وَالَّذِينَ تَبَوَّءُوا الدَّارَ وَالْإِيمَانَ مِن قَبْلِهِمْ يُحِبُّونَ مَنْ هَاجَرَ إِلَيْهِمْ وَلَا يَجِدُونَ فِي صُدُورِهِمْ حَاجَةً مِّمَّا أُوتُوا وَيُؤْثِرُونَ عَلَىٰ أَنفُسِهِمْ وَلَوْ كَانَ بِهِمْ خَصَاصَةٌ ۚ وَمَن يُوقَ شُحَّ نَفْسِهِ فَأُولَـٰئِكَ هُمُ الْمُفْلِحُونَ
(59:9) - On the other side are those who are also true to their faith. They had consolidated their faith even before the Hijra and had made room in their own dwellings for the Muhajireen. These people (the Ansaar of Madinah) welcome with love and affection whoever comes to them from amongst the Muhajireen. Further, they never think that they themselves should be receiving whatever the Muhajireen are being given. They always give preference to the needs of the newcomers, even if they themselves are indigent and living a life of hardship. (This is the symbol of a true Momin.) Remember! The people who are likely to achieve prosperity are those who change their personalities and no longer push others aside to selfishly quench their own thirst. Realizing that the other person's thirst is more important, they voluntarily allow them to satisfy it first.
These were the people whom the Quran called true believers:
وَالَّذِينَ آمَنُوا وَهَاجَرُوا وَجَاهَدُوا فِي سَبِيلِ اللَّـهِ وَالَّذِينَ آوَوا وَّنَصَرُوا أُولَـٰئِكَ هُمُ الْمُؤْمِنُونَ حَقًّا ۚ لَّهُم مَّغْفِرَةٌ وَرِزْقٌ كَرِيمٌ
(8:74) - Those who have believed, have left their homes and struggled in the cause of Allah and those who have given shelter and help to them - both these groups are the true believers (Momineen). For them there is protection from Allah as well as respectable and dignified means of nourishment.
How great is this evidence! In addition, how lofty was their destiny - May Allah be pleased with them! This bond of brotherhood became so strong that if an Ansaar died then his Muhajir brother inherited his bequest. Later when it became necessary then blood relationship was given priority:
وَالَّذِينَ آمَنُوا مِن بَعْدُ وَهَاجَرُوا وَجَاهَدُوا مَعَكُمْ فَأُولَـٰئِكَ مِنكُمْ ۚ وَأُولُو الْأَرْحَامِ بَعْضُهُمْ أَوْلَىٰ بِبَعْضٍ فِي كِتَابِ اللَّـهِ ۗ إِنَّ اللَّـهَ بِكُلِّ شَيْءٍ عَلِيمٌ
(8:74) - Those who believe thereafter, who leave their homes and join you in your struggle - they are also of you. But Allah's Laws which relate to blood-relationships do not apply to them. Allah knows all things.
Thus, after minimizing the chances of external and internal dangers to the Muslims now settled in Madinah, the Prophet (PBUH) focused his special attention on teaching and training the Muslims, because it was this new community that was to become the catalysts for the heavenly revolution. It was to become the best community in the world; so that wherever it could go, it would turn those peoples into the best community as well:
وَكَذَٰلِكَ جَعَلْنَاكُمْ أُمَّةً وَسَطًا لِّتَكُونُوا شُهَدَاءَ عَلَى النَّاسِ وَيَكُونَ الرَّسُولُ عَلَيْكُمْ شَهِيدًا
(2:143) - Our objective is to make you a people with a universal outlook to be equidistant from all other peoples, i.e., to be neither leaning towards any particular people nor estranged from another. Therefore, O Muslims! It is your responsibility to keep a watch over the activities of other peoples of the world (to see that no nation is oppressing any other nation); and the responsibility of the Messenger (being the head of the Divinely-ordained System) is to watch over your activities.
And history bears testimony to the fact that the Prophet (PBUH) did accomplish this divine goal. The new Muslim community of Madinah did become the best community in the world.