Erdogan also praised the German-born player's decision and said he had spoken with him.
“Last night I spoke to Mesut. His attitude in the statement is completely patriotic,” Erdogan said, quoted by state TRT Haber broadcaster.
“It is not possible to accept this kind of racist attitude towards a young man who poured so much sweat for the German national team's success. This cannot be tolerated.”
Özil's decision to quit playing for Germany and his strongly-worded four-page statement caused uproar in Germany while it was applauded by Turkish ministers.
He had faced heavy criticism during the World Cup, especially over a controversial photograph with Erdogan in May ahead of presidential and parliamentary polls in Turkey.
Özil, a key member of the squad which won the 2014 World Cup, criticized the German Football Association (DFB) bosses, sponsors and the media.
He lamented a lack of support from DFB president Reinhard Grindel.
“In the eyes of Grindel and his supporters, I am German when we win, but I am an immigrant when we lose,” Özil, 29, wrote.
But the association said in a statement on Monday that it rejected “the notion that the DFB is associated with racism”.
In his statement, Özil addressed critics of the photo and said that he was not making a political statement when he appeared with the Turkish leader before the World Cup finals.
“I have two hearts, one German and one Turkish,” said Özil.
Turkey Justice Minister Abdulhamit Gül congratulated Özil on Monday, saying he had “scored the most beautiful goal against the virus of fascism”.