Being arrested then rotting in prison is probably not what John the Baptist expected. He was the one sent to prepare the way for the Messiah, and he’d given up everything to do it. Nowhere in scripture did it say that this Elijah would end up like this. Was arrest equal to failure?
A little reassurance that it was all worth it was needed:
Matthew 11:2-3 John the Baptist, who was in prison, heard about all the things the Messiah was doing. So he sent his disciples to ask Jesus, ‘Are you the Messiah we’ve been expecting, or should we keep looking for someone else?’
Jesus’ answer had no theological argument; John would have had to have known all that to make claims about being that voice in the wilderness in the first place. Instead of argument, Jesus let the evidence do the talking:
Matthew 11:4-6 Go back to John and tell him what you have heard and seen— the blind see, the lame walk, the lepers are cured, the deaf hear, the dead are raised to life, and the Good News is being preached to the poor. And tell him, ‘God blesses those who do not turn away because of me.’