She made this announcement at a media conference in Los Angeles on Monday night. The 28-year-old Russian revealed she tested positive for the prohibited substance meldonium.
Sharapova will be provisionally suspended with effect from March 12, the International Tennis Federation has announced.
She has been struggling with an arm injury this year and has played in only one tournament, losing to Serena Williams in the quarter-finals of the tournament in Australia.
Many had expected Sharapova to announce her retirement when she faced the press in LA, but instead she made the shock admission of her failed test.
“I received a letter from the ITF last week that I failed a drug test at the Australian Open,” she said. “I did fail the test and I take full responsibility.
“For the past 10 years I have been given a medicine called Mildronate by my family doctor. A few days ago, after I received the ITF letter I found out it also has another name – meldonium – which I did not know.
“It’s very important for you to know that, for 10 years, this medicine was not on WADA’s banned list and I had been legally taking the medicine for the past 10 years.
“But on January 1 the rules changed and meldonium became a prohibited substance, which I had not known.
“I was getting sick very often and I had a deficiency in magnesium and a family history of diabetes, and there were signs of diabetes. That is one of the medications, along with others, that I received.
“I made a huge mistake. I know I face consequences and I didn’t want to end my career this way. I hope I will be given the chance to play this game again.”
Meldonium is designed to boost metabolism and endurance and has previously been used in the treatment of angina.
It was added to WADA’s list of banned substances on January 1 and athletes were advised as such by email in December.
“It made me healthy and that is why I continued to take it,” Sharapova said of the substance after taking a small number of questions from the floor.
“I am still working through my injury and that is the reason I withdrew from Palm Springs [the BNP Paribas Open], because I have still not healed my injury.”
Asked if she knew what the consequences of her failed test may be, Sharapova added: “I do not. This is very new for me, I just received the letter a few days ago and I will be working with the ITF.”
Sharapova was crowned Wimbledon champion as a 17-year-old in 2004 and has gone on to win the US Open, Australian Open and French Open, taking victory in the latter tournament on two occasions. She is one of only six women to win all four Grand Slam titles in the Open era.