The perceived meaning depends entirely on what was said before this sentence. It could be the teacher, but why would the teacher tell you to see the teacher? Maybe this might arise if the teacher wanted to meet with you outside the class, for example after school.
You went to the headmaster? Did the teacher tell you to see him?
Clearly, the speaker wants to know whether the teacher told you to see the Headmaster.
Why are you late back from school? Did the teacher tell you to see him?
No other person is mentioned, so you can safely assume that the speaker is asking whether the teacher told you to see the teacher (after school).
I spoke to the headmaster about you today. Did the teacher tell you to see him?
This is ambiguous- the speaker could be asking whether the teacher asked you to see the teacher (because the headmaster subsequently spoke to the teacher), or to see the headmaster.