谁 is an Interrogative Pronoun. When 谁 modifies a Noun, we usually followed it with 的.
eg,
谁的书?
比一比谁的成绩好?
这是谁的意见?
And if the Noun is a kinship Noun, the 的 can be taken with or without.
他是谁的哥哥? (ok)
他是谁哥哥? (ok)
老师 is a Noun, but it is not a kinship Noun, so 的 should be added.
他是谁的老师? (ok)
他是谁老师? (X)
(more)eg,
谁的书?
比一比谁的成绩好?
这是谁的意见?
And if the Noun is a kinship Noun, the 的 can be taken with or without.
他是谁的哥哥? (ok)
他是谁哥哥? (ok)
老师 is a Noun, but it is not a kinship Noun, so 的 should be added.
他是谁的老师? (ok)
他是谁老师? (X)