As a former teacher, I agree with both Chai2 and izzy.
An additional reason for teachers having an answers key is, to save time.
This is especially important when a test has been written by another person. (Teacher)
Of course, the answer key can occasionally be wrong. Rare; but, it does happen. This is a good reason for teachers to go through the test, a question at a time (after the tests are graded and returned), to discuss with students why an answer is correct. This gives the student the opportunity to argue for the supposedly incorrect answer they gave.
(this happened when I was a student in high school biology on the midterm exam. The fool teacher just went with the key and during class review I pointed out the error. Victory was mine, as I knew it would be.). (it had to do with the electron microscope)
Apparently, another science teacher had written the test and supplied the answer key - error and all.
If a student had the key prior to the exam it would be wrong. It would also negate the value of test scores.
Study harder, play video games less.