The trade came two days after Pirates backup shortstop Chase d'Arnaud, injured in a rundown drill earlier, had surgery for a torn ligament in his left thumb. He is expected to be sidelined six to eight weeks.
The 38-year-old McDonald hit .249 in six homers and 22 RBIs in 70 games for Arizona last season and gives the Pirates an experienced reserve for regular shortstop Clint Barmes.
McDonald, who can also play second base and third base, made only one error in 210 chances last season.
"He's a professional player. A lot of experience. Above average defender. He's got infield presence. Clubhouse presence. He's just a seasoned vet," Pirates manager Clint Hurdle said.
McDonald found himself the odd man out at a crowded position. Cliff Pennington and Willie Bloomquist are expected to share the spot when the season begins, with top prospect Didi Gregorius waiting at Triple-A Reno.
"He's a very accomplished defensive player and a veteran presence," Pirates general manager Neal Huntington said. "He brings depth and stability at a position where all of a sudden we didn't have much depth or stability."
McDonald has spent parts of 14 seasons in the majors with Cleveland, Detroit, Toronto and Arizona. He went to Arizona along with Aaron Hill in a trade that sent Kelly Johnson to Toronto in August 2011.
McDonald appeared in a career-high 123 games with Toronto in 2007 and batted .251. He is a .237 career hitter.
We like the defense and we like the player," Huntington said. "Secondarily, he brings experience. He's been through the battles."
Braves 18, Pirates 9
KISSIMMEE, Fla. (AP) — Freddie Freeman and Andrelton Simmons each hit two home runs and the Atlanta Braves bopped the Pittsburgh Pirates 18-9 Wednesday.
Freeman went 4 for 4 and drove in four runs. He's hit five of his seven spring homers in the past six games and is batting .373 (22 for 59) this spring.
Simmons also doubled in his first game back from the World Baseball Classic.
Kyle McPherson, competing for a spot in the Pirates' rotation, gave up 10 hits and nine runs in 4 2-3 innings.