McGonagall was unhappy at the Ministry and when offered a big promotion, she instead sent an owl to Hogwarts asking if she might be considered for a position at the school. She was offered a post and took it immediately.
There is a contradiction between Rowling's statement during an interview that McGonagall was "a spritely seventy" in 1995 and her informing Umbridge during 1995 that she had been teaching at Hogwarts for thirty-nine years in December. If she was in fact 70 years old in 1995, she would have been teaching at Hogwarts for forty-nine years, not thirty-nine.
It is possible that she was telling Umbridge that she had held the position of head Transfiguration teacher for thirty-nine years, or she was deliberately subtracting ten years from her service. Both explanations are a stretch, especially the idea that she would in any way minimize her level of experience when talking to Umbridge. The other explanation is that Rowling's comment that McGonagall was seventy years old was incorrect. This seems the most likely, given her self-admitted poor math skills.
Of course, any discussion of dates with regards to McGonagall bumps into her canon-breaking appearance in "Crimes of Grindelwald." Until we learn more about that apparent error in Rowling's timeline, we'll stick with what's in the books, since we KNOW that came from Rowling herself.