McDonald bagged 25 goals on loan at Priestfield two seasons ago and having returned to the Kent club this week on loan from Coventry, he salvaged a draw for the Gills with five minutes to go.
York went ahead when the Gillingham defence failed to deal with Patrick McLaughlin's corner and Charlie Lee diverted the ball into his own net on 17 minutes.
Gills skipper Adam Barrett nearly levelled things before the break, his header forcing a superb reflex save from York stopper Michael Ingham.
York's Chris Smith then went a whisker away from doubling the advantage, glancing a header off the post on the hour.
And Lee's day went from bad to worse when he was forced off with a head injury, leaving the Gills with only ten men for the last ten minutes having used all their substitutes.
But McDonald finally got the breakthrough, glancing in Miles Weston's looping cross to rescue a point in his first game back at Priestfield.