They are both very important holy cities in Islam
Mecca is the birthplace of the prophet Muhammad and Kaaba is also located there
Medina is where the early Muslim community developed
I hope this helps:)