Let us first look at verses 2 & 3
2Now when John had heard in the prison the works of Christ, he sent two of his disciples,
3And said unto him, Art thou he that should come, or do we look for another?
Please note that it said that John had already heard of the works of Christ. That is not too hard to believe considering that at some point in time his disciples must have reported to him all that they had witnessed Jesus doing. They must have told him about Jesus preaching to Matthew and the tax collectors, or about the blind that received their sight and the deaf that now hear. And they also must have mentioned to John that Jesus was raising the dead, the lame were standing up and walking and incurable diseases were being cured.
Not only did John's disciples testify of the works of Jesus but John himself also testified of who Jesus was and witnessed with his eyes the Spirit of God descending from heaven upon him like a dove. It was John who saw Jesus approaching him and said, "Behold the Lamb of God, which taketh away the sin of the world" and "I have seen and I testify that this is the Son of God." (John 1:29-36)
John knew who Jesus was and believe in Him. So then, why was he asking Christ if he was really the Son of God? Let us read on. After John's disciples asked Jesus John's question ...
"4Jesus answered and said unto them, Go and shew John again those things which ye do hear and see:In verse 6, Jesus told John to not be offended by Him. Why would John, a man filled with the Holy Spirit since he was in the womb, be offended by Jesus? Let us use our minds for a moment to put ourselves in John's position.
5The blind receive their sight, and the lame walk, the lepers are cleansed, and the deaf hear, the dead are raised up, and the poor have the gospel preached to them.
6And blessed is he, whosoever shall not be offended in me."
John was a great prophet of God. He had a calling on his life that could not be shaken for even the prophet Isaiah spoke of him during his prophetic ministry. John spent his entire life in servitude to the Lord. He was humble and did not seek after glory, fame or riches. He faithfully stayed his course and when Jesus came to him, he was ready to receive him. Now there came a time when John got Herod the Tetrarch very angry since he reproved him for his brother's wife Herodias and his wicked lifestyle. For that reason, Herod threw John in to prison and John was in danger of being beheaded. Let us imagine his conditions in prison for just a moment. Picture the solitude of his cell, the darkness, his frail body laying flat on the ground as he lamented to God day and night. Imagine the smell - the air filled with a mix of pungent odors, the type that one never seems to get accustomed to. Food probably came every other day, if so much, and was not anything to desire.
John was an afflicted man. I could imagine him reflecting on the life that he lived, bringing to remembrance all that he had done for God. He must have asked God a thousand times, "Why?" "Why are you allowing me to suffer in this prison?" His prayers seemed to get no further than the ceiling and his soul found no rest. He refused to be comforted by the Holy Spirit who tried to tell him of the great reward in store for those who endure. I could also imagine his thoughts changing as his hope faded and anger and discontent surrounded him to "Are you really God? Because if you were, you would have rescued me by now? Why would God cause me to die like a dog in prison?" He allowed his flesh to get the best of him and that is when, through the bars of his cell, he commanded his disciples to relay his question to Jesus, "are you really the son of God?"
But God, in His lovingkindness, gently responded to John with an answer and a rebuke to comfort his soul during his affliction. Jesus then already forgave John for his sin and began to speak very highly of him to the multitudes that had surrounded Jesus. (Mat 11:7-19) Because he loved John and he understood his affliction.
Jesus has been in our position. He has been tempted, tormented, afflicted, persecuted, teased, beat up, alone, betrayed multiple times, forsaken by everyone, lied on, lied to, grieved, doubted by others, and every other situation you can find yourself in, Jesus has been there. He loves you, and wants you to understand that he knows how you feel. But do not lose heart, and do not be offended by him when it seems as if he is no where to be found, or it seems as if he doesn't care. He does because he LOVES you.