I am trying to understand these pronouns. The sentence below is a number shift, corret?

The teacher said they were going to grade the test over the weekend.

Yes. It's a number shift. The pronoun, "they," which is plural, refers to the singular "teacher."

It should be: The teacher said she . . .
or
The teacher said he . . .