It's said that, while he was in Medina, Muhammad received a revelation, instructing those in prayer to face in the direction of the Kaaba in Mecca.
قيل أنه وأثناء وجوده فى المدينة أتاه الوحــى يأمر المسلمين بالتوجه فى صلاتهم إلى الكعبة فى مكة