One may wonder, “Why would the Prophet (peace and blessings be upon him) and Muslims leave their hometown, Makkah, to a very distant place like Madinah?”
The straightforward answer is: because he and the Muslims were not able to worship Allah in Makkah and they had been tortured by the Makkans.