Can a person migrate to Madeenah as the Prophet (peace and blessings of Allaah be upon him) did?
It is obligatory to migrate from the land of kufr to the land of Islam, for those who are not able to practise their religion openly. Allaah says (interpretation of the meaning):
“Verily, as for those whom the angels take (in death) while they are wronging themselves (as they stayed among the disbelievers even though emigration was obligatory for them), they (angels) say (to them): ‘In what (condition) were you?’ They reply: ‘We were weak and oppressed on the earth.’ They (angels) say: ‘Was not the earth of Allaah spacious enough for you to emigrate therein?’ Such men will find their abode in Hell — what an evil destination!”
And the Prophet (peace and blessings of Allaah be upon him) said: “I disavow every Muslim who settles among the mushrikeen.” Narrated by Abu Dawood, 2645; classed as saheeh by al-Albaani in Saheeh Abi Dawood.
But if he is able to practise his religion openly, then he does not have to migrate. See question no. 13363.
If he thinks that staying in his country is more beneficial because he will be able to call others to Islam and guide people, and he is confident of his religious commitment, then his staying there is better than his migrating. See question no. 47672.
Hijrah (migration) does not necessarily have to be to Madeenah, rather you can migrate to any Muslim land where you can establish the symbols of Islam and safely practise Islam.
And Allaah knows best.