The correct answer to this open question is the following.
During the Ottoman Empire, Cairo and Baghdad likely grow into large cities because both represented major and important places of trade and social interaction in those years. Baghdad, the capital city of Iraq, since 762 CE, became the place were scientists, scholars, historians, and philosophers lived in a great time of advances and the spread of Islam. Historians call this time as the Golden Years of Islam. In the case of Cairo, Egypt, since the Byzantine times, Egypt had been dominated by Arabs who spread the teachings of Islam. By the tie of the Ottoman Empire, Cairo, Egypt, was also a cosmopolite city, full of people and trade activities where people could find jobs, commercial activities, and cultural exchange.