John had known his entire life (even when he was in the womb) that Jesus was the Messiah. He probably heard the story about leaping in the womb over and over while growing up. He knew who Jesus was. But because of circumstances and misconceptions about how Jesus would act and appear, John got his eyes off God.
Look at what John says about Jesus right before he baptizes Jesus. He says, "He who is coming after me is mightier than I, and I am not fit to remove His sandals; He will baptize you with the Holy Spirit and fire. And His winnowing fork is in His hand, and He will thoroughly clear His threshing floor; and He will gather His wheat into the barn, but He will burn up the chaff with unquenchable fire.'" Matthew 3:11-12
What John said was true, but it wasn't going to happen at that time. John was under the misconception like so many Jews that Jesus was coming as a roaring lion the first time. He probably bought into the belief that Jesus would set up His earthly kingdom at this time.
So, when none of that happened, when John instead found himself in prison, his faith was knocked around a bit. His eyes were off God because God didn't act how he expected him too.
What did Jesus do? Jesus didn't condemn John for his misconceptions. Jesus didn't indulge him in his misery or even acknowledge John's imprisonment. Instead Jesus gave him stories of what was going on, how God was working. He did this to get John's eyes back on God and lead him to the truth once again.
Jesus never wasted time trying to make sure John and his disciples understood it all. He knew they didn't. He gave them time to accept truth, to see it unfold.
Do we give people time? Do we let the Spirit work in their hearts or do we try to do it for the Spirit?