The visit came on Sunday, with the president inspecting the underway refurbishment work, a week after Turkey's top court green-lighted the process, the president's office reported. The office also provided pictures showing scaffolding inside the building.
Some 500 people are to join Muslim prayers in the building Friday, the first such occurrence since 1934, when then-Turkish ruler Mustafa Kemal Ataturk turned it into a museum. It was not clear whether Erdogan will join the prayers.
The site was built as a cathedral during the Byzantine empire, but was converted into a mosque after the Ottoman conquest of Constantinople in 1453.
Erdogan, however, said last year that it had been a "very big mistake" to convert the Hagia Sophia into a museum.
On Sunday, Turkish presidential spokesman Ibrahim Kalin said in a television interview that mosaics depicting Mary and Gabriel that face Qiblah, the direction in which Muslims stand while saying their prayers, would be covered with curtains or lasers during the upcoming prayers.
"Our goal is to avoid harming the frescoes, icons, and the historic architecture of the edifice," the official said.