The 30-year-old Özil, who has Turkish family roots, sparked controversy last year when he was photographed with Erdogan, raising questions about the footballer's loyalty to Germany on the eve of their disastrous 2018 World Cup campaign.
The Turkish leader arrived in the early evening for Friday's ceremony at a luxury hotel on the banks of the Bosphorus to see the former Arsenal midfielder marry his fiancee, former Miss Turkey Amine Gulse.
A smiling Erdogan and his wife Emine were seen standing next to the young couple as their marriage was formalised.
After 92 appearances for Germany, including a key role in the 2014 World Cup victory, Özil suddenly quit the national squad last July, accusing German football officials of racism.
Özil announced in March that he had asked Erdogan to be his best man.
German Chancellor Angela Merkel's chief of staff was part of a chorus of criticism of the invitation.
Helge Braun, a CDU told the Bild newspaper then that it “makes one sad” that Özil would make a such a move despite having already been sharply criticised by the German public over his first meeting with Erdogan.
Özil has dated Gulse since 2017 and the couple announced their engagement in June 2018.
The footballer, a third-generation German, whipped up a political storm when he was pictured alongside Erdogan last May.
Criticism intensified after the red-faced defending champions crashed out of the first round of the World Cup in Russia.
In the wake of the World Cup fiasco, Özil announced his resignation from the national squad, saying: “I am German when we win, an immigrant when we lose”.
Erdogan often attends marriages in Turkey of celebrities, whom he particularly seeks out during election campaigns.
His presence at Özil's marriage comes ahead of a mayoral election in Istanbul on June 23rd, required after the original voting in March was annulled following a narrow victory for the main opposition Republican People's Party.
READ ALSO: Five key dates in the Mesut Özil saga