The Bible does contain a number of apparent contradictions. Believing in the inspiration and inerrancy of the Word of God we know that all of these can be reconciled. It may be that a complete explanation will not come until heaven. For example, think of the Old Testament saint, who read in one text that the Messiah would suffer (Isaiah 53:1-6), but in another that He would triumph over His enemies (Psalm 2:7-9). Only in the light of our Lord’s first coming (and His teaching concerning His return) can we understand that which puzzled Old Testament saints, even prophets (1 Peter 1:10-11).
In the case of the question you have raised, the problem is more a matter of translation. Unfortunately the translators of the King James Version did not take into account the fact that the same Greek word meant both “hear” and “understand.” Also, the same Greek word can mean both “sound” and “voice.” The apparent contradiction is correctly solved by the translation of the NET Bible, as well as that of the NASB and the NIV:
9:7 (Now the men who were traveling with him stood there speechless, because they heard the voice but saw no one.)
22:9 Those who were with me saw the light, but did not understand the voice of the one who was speaking to me.
NIV Acts 9:7 The men traveling with Saul stood there speechless; they heard the sound but did not see anyone.
NIV Acts 22:9 My companions saw the light, but they did not understand the voice of him who was speaking to me.