The 20-year-old was released by QPR last week, having moved to Loftus Road from Livingston eighteen months ago.
United manager Jackie McNamara told the club’s website: “He is skilful, physical and quick and will add to the competition amongst the defenders we have got here.
“We are extremely fortunate that he was available and it was important that we got him before others were aware.”
Donaldson said: “Things have moved pretty quickly but it is great to sign the contract and I am now looking forward to playing in the tangerine jersey.
“The manager’s desire to sign me and his vision for taking the club forward convinced me this was the right place to enhance my development and improve as a player.”
Donaldson joined QPR in a £150,000 deal after impressing then QPR manager Harry Redknapp during a week-long trial. He made his one and only appearance for the club in a 3-2 Championship win at Barnsley in May last year.