The 28-year-old Russian made the shocking revelation at a pre-arranged press conference in Los Angeles, on Monday night.
Sharapova, who has played in only one tournament this year, losing to Serena Williams in the quarter-finals of the Australian Open, said she received a letter from the ITF informing her of the failed test for meldonium – a substance which has been on the banned list since January 1, 2016.
Sharapova, who took “full responsibility” for the failed test, said she has been taking the drug legally since the age of 16, but did not realise it had subsequently been banned.
“I received a latter from the ITF that I failed a drugs test at the Australian Open,” said Sharapova. “I take full responsibility for it.
“For the past 10 years I have been given a medicine called mildronate by my family doctor and a few days ago after I received the ITF letter I found out that it also has another name of meldonium, which I did not know.
“It is very important for you to understand that for 10 years this medicine was not on WADA’s banned list and I had legally been taking the medicine for the past 10 years.
“But on January 1 the rules had changed and meldonium became a prohibited substance, which I had not known.”
Reading from a written statement that lasted for nearly three minutes, Sharapova said she was given the substance by her family doctor to deal with sickness, a deficiency in magnesium, and her family’s history of diabetes.
“I was given this medicine by my doctor for several health issues that I was having in 2006,” Sharapova continued.
“Throughout my long career I have been very open and honest about many things and I take great responsibility and professionalism in my job every single day and I made a huge mistake.
“I let my fans down. I let the sport down I have been playing since the age of four and I love so deeply.
“I know with this I face consequences and I don’t want to end my career this way and I really hope I will be given another chance to play this game.
“I know many of you thought I was retiring, but if I was ever going to announce my retirement it would probably not be in a downtown Los Angeles hotel with this fairly ugly carpet.”