The five-time grand slam champion - who won Wimbledon in 2004 as a 17-year-old - has struggled with chronic shoulder problems and has slumped to 373 in the rankings.
She was banned from tennis in 2016, initially for two years, after a positive drugs test.
"How do you walk away from the courts you've trained on since you were a little girl, the game that you love - one which brought you untold tears and unspeakable joys - a sport where you found a family, along with fans who rallied behind you for more than 28 years?
"I'm new to this, so please forgive me. Tennis - I'm saying goodbye."
Sharapova, 32, will go down as one of the greats of the era - only Serena and Venus Williams have won more slam titles among current players.
She made herself a global star by winning Wimbledon and added the US Open title in 2006 and the Australian Open in 2008 before twice lifting the trophy at Roland Garros, in 2012 and 2014.
But her impact on court was trumped by her profile off it, with the Russian the world's highest-earning female athlete for much of her career.
She returned to action in April 2017 but was unable to reach her previous heights, peaking at a high of 21 in the rankings and reaching just one grand slam quarter-final.
Sharapova was restricted to eight tournaments last year and struck a pessimistic note about her future prospects after losing in the first round of the Australian Open in January.