Answer:
A. Drew thanked his friends for visiting him when he hurt his leg.
Step-by-step explanation:
A prepositional phrase has to relate back to the noun, verb, or adjective it describes. The only sentence that contains a clear relation between the phrase and the rest of the sentence is "Drew thanked his friends for visiting him when he hurt his leg." The preposition "for" relates to why Drew thanked his friends.