hijrah was not something special for prophet muhammad (peace and blessings be upon him). rather, some of allah’s prophets emigrated before prophet muhammad (peace and blessings be upon him). yet, the hijrah of prophet muhammad (peace and blessings be upon him) differed from those of other prophets because it was not intended as a flight from torture but as the beginning of the islamic state.
responding to the question, the eminent muslim scholar, sheikh yusuf al-qaradawi, states the following:
most of allah’s messengers, if not all, emigrated. however, their emigrations differed from that of prophet muhammad (peace and blessings be upon him). for example, prophet ibrahim (peace and blessing be upon him) emigrated, as related in the qur’an: (and lot believed him, and said: lo! i am a fugitive unto my lord. lo! he, only he, is the mighty, the wise) (al-`ankabut 29: 26). in another verse, he almighty says: (and he said: lo! i am going unto my lord who will guide me) (as-saffat 37: 99). so, prophet ibrahim (peace and blessings be upon him) migrated from place to place till he settled at a town in palestine, where he was then buried. that town, al-khalil ibrahim, is now named after him.
prophet musa (peace and blessings be upon him) also emigrated before he was assigned with the divine mission. he fled from egypt after he had mistakenly killed an egyptian. he sought allah’s forgiveness for that, and a man advised him to get out of egypt in order to escape people’s revenge. allah almighty says: (and a man came from the uttermost part of the city, running. he said: o moses! lo! the chiefs take counsel against thee to slay thee; therefore escape. lo! i am of those who give thee good advice. so he escaped from thence, fearing, vigilant. he said: my lord ! deliver me from the wrongdoing folk) (al-qasas 28: 20-21).
then prophet musa (peace and blessings be upon him) went to a country called madyan, where he married the daughter of a righteous old man (prophet shu`aib, peace be upon him) and stayed with him for ten years. throughout that period, musa had no divine mission. he lived as a righteous man, a good husband, and a generous son-in-law; however, he had no prominent role to perform.
that is to say, prophet musa (peace and blessings be upon him) emigrated for fear of revenge. he said, as related in the qur’an: (then i fled from you when i feared you, and my lord vouchsafed me a command and appointed me (of the number) of those sent (by him)) (ash-shu`ara’ 42: 21). on the other hand, the hijrah of prophet muhammad (peace and blessings be upon him) was not only to escape temptation and torture of his people. it was the starting point to establish the muslim ummah, a new muslim community based on islam, the universal divine message that calls for morality and human rights. that was the very purpose of prophet muhammad’s hijrah to madinah, and he (peace and blessings be upon him) performed his role as best as possible. he put the foundation of a sound muslim community and established the best ummah ever created.