This is a commonly, albeit ignorantly, pointed out contradiction that is no contradiction at all. First off, which translation are you using, and why does the NIV say something different? Could be because it wasn’t in English, therefore you have to go and see why there is a difference. For instance, if I look at my son and say “Do you hear me?” when he’s standing right in front of me, I’m asking if he understands me, not if he hears me. So the connotation of ‘hear’ is different than saying someone who is deaf can’t hear, as someone who is deaf can understand, but can’t hear. So let’s look at the same passage in the NIV, then the Greek:
Acts 9:7 The men traveling with Saul stood there speechless; they heard the sound but did not see anyone
Acts 22: 9 My companions saw the light, but they did not understand the voice of him who was speaking to me.
So the Greek:
ἀκούω akouō ak-oo’-o A primary verb; to hear (in various senses):—give (in the) audience (of), come (to the ears), ([shall]) hear (-er, -ken), be noised, be reported, understand.
So clearly they were saying they heard the noise, but didn’t understand it, as it was possibly not in their language, as was made clear when Paul said in Acts 26:14 And when we all had fallen to the ground, I heard a voice speaking to me and saying in the Hebrew language, ‘Saul, Saul, why are you persecuting Me? It is hard for you to kick against the goads.’
They which were with me (Paul) saw indeed the light, and were afraid, but they heard not the voice of him that spake to me.” In this place, the words “heard not the voice” must be understood in the sense of “understanding the words,” of hearing the address, the distinct articulation, which Paul heard. They heard a “noise”; they were amazed and alarmed, but they did not hear the distinct words addressed to Saul. A similar instance occurs in John 12:28-29, when the voice of God came from heaven to Jesus, “The people who stood by and heard it said it thundered.”
So whether they heard it as a thunder, they didn’t speak Hebrew, or just didn’t understand, clearly this is a weak case for a contradiction.