Maria Sharapova felt "trapped" and "tricked" after learning she had failed a drugs test for taking the banned substance meldonium.
The former world number one tested positive at the 2016 Australian Open and was initially banned until January 2018.
However, the Court of Arbitration for Sport reduced the two-year suspension to 15 months after ruling that she was taking meldonium – which had only been added to WADA's prohibited list at the start of 2016 – for medical purposes and not to enhance performance.
Sharapova returned to the WTA Tour in April and played at her first major tournament since her ban at the US Open, where she reached the fourth round.
The five-time grand slam champion said she was making plans for her retirement before she received news of her failed test.
Writing in her autobiography 'Unstoppable, by Maria Sharapova', an excerpt of which was published in The Guardian, she wrote: "I was imagining my retirement in the winter of 2015. I'd play through the winter and spring, appear at the Olympics in Rio, then begin my last professional season, with my book published just before the 2017 US Open. I’d tell my story and say goodbye.
"The 2016 season began at the Australian Open. Serena Williams beat me in the quarter-finals. It felt like a decent start to my 12th pro season. But, as sometimes happens in nightmares, what felt like the beginning turned out to be the end.
"A few weeks later, when I was back in LA, training, I got a funny-looking email. It was from the International Tennis Federation. As I read, my heart started to pound.
"It said the urine sample I had given in Australia had come back positive. In other words, and I had to read this again and again to make sure I was not hallucinating, I had failed the drug test. How? What the hell could it be?
"I took nothing new, nothing that was not legal and prescribed by a doctor. It was called meldonium. OK, obviously this was a mistake. Who had ever heard of that? I Googled it, just to make sure.
"Then I understood. I knew meldonium as Mildronate, the brand name. It was a supplement I'd been taking for 10 years. It's an over-the-counter supplement in Russia, so common that you don't think of it as a drug, let alone a performance-enhancing one.
"I'd first been told to take it when I was 18 and getting sick a lot; I had an issue with irregular heartbeats. For seven years, I had written confirmation that all the supplements I was taking, including Mildronate, were permissible.
"As of January 2016, meldonium was included in a catalogue of banned substances that the ITF sent out to players. It was viewable by clicking through a series of links in an email. I never followed those links, and didn't ask any of my team to.
"That was my mistake. But the ITF didn't draw any attention to the fact that they were suddenly banning a supplement that was being legally used by millions of people. That was their mistake.
"I felt trapped, tricked, but I figured all I had to do was explain myself. Meldonium had been banned for four weeks. At worst, I had inadvertently been in violation of the ban for less than 28 days.
"But I soon realised I was running into a brick wall. If I failed to win my case, I could be banned for up to four years. It would be the end of my career."