It became a mosque in 1453 when the Ottomans took over the Byzantine Empire. It remained a mosque until the Ottoman Empire broke apart after World War II and Attaturk created a secular and modern Turkey. That is when the mosque became a museum.
Now the Turkish government wants to turn the Hagia Sophia back into a mosque angering many Christians. For example, the Archbishop of Constantinople told a Turkish newspaper, that "if it is to reopen as a house of worship, then it should open as a Christian church." He also reminded the newspaper that the Hagia Sophia was built as a church, not a mosque. According to the Huffington Post, some say the current government is simply giving " payback against Turkey’s former secular military elite, which has historically jailed leaders of religious parties and staged coups against elected governments."
This might be an interesting debate for students.Should the Hagia Sophi be converted to a mosque, an eastern orthodox church, or simply remain as a museum. And here's the story from NPR.