The Cubs announced the deals on Thursday. Hammel is set to earn $6 million next season while McDonald, whose deal is not guaranteed, is due $1 million plus performance bonuses.
The 6-foot-6 Hammel was Baltimore's opening day starter last season but went 7-8 with a 4.97 ERA in 26 appearances - 23 starts. He had a 3.43 ERA in 20 starts in 2012 - his first year with the Orioles.
Shoulder problems limited McDonald to six starts with Pittsburgh a year ago.
If Hammel and McDonald succeed, they might be traded for prospects before the deadline. The Cubs did that with Paul Maholm and Scott Feldman the past two seasons.