In a statement the ITF said the five-times grand slam champion's ban would be backdated to January 26 this year, meaning her results and prize money from the Australian Open, where she reached the quarter-finals, would be canceled out, Reuters wrote.
Sharapova, 29, said she would appeal to the Court of Arbitration for Sport (CAS), describing the punishment as "unfairly harsh."
She said an independent tribunal in London on May 18-19 had found that she had not intentionally violated anti-doping rules.
A 33-page report of the tribunal's findings said: "The ITF accepts that the player did not engage in conduct that she knew constituted an antidoping rule violation," but it rejected her assertion that there was no "significant" fault on her part.
"She was the sole author of her own misfortune," it said.
On its website, the ITF said the ban, which could have been as long as four years, had been backdated due to Sharapova's "prompt admission" of taking the substance, and would end on midnight of Jan. 25, 2018.
The World Anti-Doping Agency (WADA) later issued a short statement saying it would review the decision before deciding whether to use its independent right of appeal to CAS.
Sharapova has regularly battled back from serious injuries during her glittering career but the two-year ban means she will not be eligible to play until after the 2018 Australian Open when she will be 30, and raises the question of whether she will ever play again.
"If it stands, then I think it will be difficult for her to come back at the same level," the president of the Russian Tennis Federation, Shamil Tarpishchev, told TASS news agency, calling for the penalty to be reduced.
The ban will have an enormous impact on Sharapova's earning potential.
Read alsoFBI probing allegations around Russian doping scandalSwiss watchmaker TAG Heuer cut its ties with Sharapova after the news of her doping violation while other sponsors such as Nike and Porsche distanced themselves from her.
Sharapova has 35 Women's Tennis Association (WTA) singles titles and has won all four of the sport's grand slam titles.
Her career earnings amount to $36 million while her off-court earnings, according to Forbes, are around $200 million.