While the answers that explain the pronoun reference issue might explain why your teacher calls this sentence wrong, you should know that, in common use, it's not wrong. It's barely awkward.
People are smarter than stupid computer programs and grammar formalisms. We all know that you can't hang a fire from a tree. Furthermore, the deer is fronted -- highlighted as the primary subject by placement in the first position of the sentence. So, in the context of a narrative of a hunter camping out, any of us would read that sentence and understand it, without any need to stop and puzzle over the binding of 'it'.
Personally, on the other hand, I find 'to hang it from' to be a bit clunky. If I had to pull one smoother idea out of my head, I'd offer '... for a tree where he could hang it.'
Note that I didn't feel any need to replace 'it' with 'the roasted deer,' as per my point above.
Pronoun reference confusion has to be cleaned up when the competing nouns are more or less interchangeable, so that there is, in fact, the potential for confusion. This is the source of an endless supply of unintentionally humorous headlines in newspapers. But when there are two things that disambiguate (the non-hang-ability of fires and the fronting of the deer), there's no problem to solve.