The former Germany international was recently with Turkish side Istanbul Basaksehir, where he was hampered by fitness issues and made just four appearances this season, with his final appearance coming on February 2.
Ozil is widely regarded as one of the most gifted playmakers of his generation and turned out for clubs including Schalke 04, Werder Bremen, Real Madrid, Arsenal and Fenerbahce.
Ozil won 92 caps for Germany, scoring 23 goals and won the FIFA World Cup in Brazil in 2014.
He won four FA Cups while at Arsenal and his three-year spell with Los Blancos earned him a La Liga title, Copa del Rey and Supercopa de Espana.
"After thoughtful consideration, I'm announcing my immediate retirement from professional football," he wrote in a statement on his personal Twitter account on Wednesday.
"I've had the privilege to be a professional football player for almost 17 years now and I feel incredibly thankful for the opportunity.
"But in recent weeks and months, having also suffered some injuries, it's become more and more clear that it's time to leave the big stage of football."
"It has been an amazing journey filled with unforgettable moments and emotions," Ozil added in his statement.
"I want to thank my clubs – Schalke 04, Werder Bremen, Real Madrid, Arsenal FC, Fenerbahce, Basaksehir and the coaches who supported me, plus team-mates who have become friends.
"Special thanks must go to my family members and my closest friends. They have been a part of my journey from day one and have given me so much love and support, through the good times and the bad.
"Thank you to all my fans who have shown me so much love no matter the circumstances and no matter which club I was representing.
"Now I'm looking forward to everything that is in front of me with my beautiful wife, Amine, and my two beautiful daughters, Eda and Ela – but you can be sure that you will hear from me from time to time on my social media channels. See you soon, Mesut!"