From his prison cell, John must have had his doubts about Jesus. Like so many others, John expected the Messiah to come with all the external, visible signs of pomp and ceremony fit for a king. Then there would have been no doubt who Jesus was. But John wasn't seeing that.
He also must have expected his own difficult, unpleasant circumstances to be so much different and better if, in fact, he was following the "real" Messiah. But he wasn't seeing that either.
He wavered in faith because of his own imperfect expectations and his own circumstances. He wasn't seeing Christ at work from his prison cell, only hearing (v.2) about Him. John needed to be reassured.
Sometimes we find ourselves, like John, having doubts and wavering in our faith. God isn't visibly powerful in our lives like we think He should be. Our circumstances aren't easy or pleasant at all. We just can't seem to see God at work.
But we must not stumble or "be offended" (NIV) because of Him. We must not get discouraged or give up when God doesn't respond to our imperfect expectations. He's late meeting our time schedule. He's not opening the right (or any) doors. He doesn't fix our circumstances to suit us. Unmet expectations and circumstances can lead to doubt. Proverbs 13:12 tells us that prolonged expectation (hope deferred) makes our hearts weak.
In trials and situations, never doubting, we must cling to our faith and rely on hearing God's Word concerning us whether or not we see anything. Our seeing must not blind us from what we know in our hearts to be the truth concerning God and His promises. That truth is what will give us the reassurance we need to remain steadfast in our faith. Jesus said the man who has no doubts about Him will be blessed (envied).
Sock Monkey Snippet: The man who has no doubts about Him will be blessed.