The 29-year-old had been at the Riverside Stadium for three and a half years, scoring 40 goals in 124 appearances, following his big-money transfer from Celtic.
McDonald began his career as a trainee at Southampton and had loan spells with Huddersfield and Bournemouth before moving north of the border to join Motherwell in January 2004.
The Australian starred for the Steelmen, netting 47 goals in only 125 appearances, including two goals in the final two minutes as Motherwell wrecked Celtic's 2004/2005 title hopes on the final day.
McDonald's double handed the league silverware to Old Firm rivals Rangers but the Hoops paid £700,000 for the player's services in July 2007.
McDonald scored in a 1-1 draw with Spartak Moscow in a Champions League third qualifying round tie on his debut before scoring 64 goals in total in 127 appearances before his move to Middlesbrough.
McDonald has appeared 26 times for his country, but not since a substitute introduction in a 3-1 friendly defeat by Scotland last August, and becomes Steve Lomas' sixth summer signing since taking over the reins at The Den.
Fellow forward Steve Morison, Stephen Bywater, Jermaine Easter, Lee Martin, Richard Chaplow and Nicky Bailey have all joined the Lions in the off season.
Northern Irishman Lomas said: "I've watched Scott throughout his career and he has a proven track record, scoring at better than one in three games over a long period.
"He works hard for the team, links play well and can operate in different formations.
"The great thing from our point of view is that he's hungry to do well. He's got his eye on next summer's World Cup for Australia and knows that to get into the squad he needs to be scoring goals for Millwall."