The commissioner's office said the suspension for the violation of the MLB Joint Drug Prevention and Treatment Program is without pay and begins immediately.
Cabrera issued a statement through the players' union accepting the punishment.
"My positive test was the result of my use of a substance I should not have used," he said. "I accept my suspension under the joint drug program and will try to move on with my life. I am deeply sorry for my mistake and I apologize to my teammates, to the San Francisco Giants organization and to the fans for letting them down."
The Giants issued a statement saying they "were extremely disappointed to learn" of Cabrera's suspension, the San Francisco Chronicle reported.
"We fully support Major League Baseball's policy and its efforts to eliminate performance enhancing drugs from our game," the team's statement said.
The 28-year-old all-star from the Dominican Republic is hitting .346 with 11 home runs and 60 runs batted in. He was the most valuable player in the 2012 All-Star Game.
Cabrera previously played for the New York Yankees, Atlanta and Kansas City.