Muhammad fled to Medina when he left Mecca in 622 CE. This migration of Prophet Muhammad along with his followers is also known as Hijra or Hegira. The main reason behind the migration of Muhammad from Mecca was the plot to assassinate him. I hope that the answer has helped you.