Thomas was not with the disciples when Jesus first appeared after the resurrection. We are not told why and it may not be important. But while the other ten were locked in the upper room out of fear, Thomas was someplace else. Thomas seemed ready to die with Jesus in John 11, so it may be the case that he is willing to go about his life, almost daring the Jews to arrest him too.
On the other hand, perhaps Thomas experienced a “crisis of faith” when Jesus died. If he believed Jesus was the Messiah and that the Messiah was not going to be crucified by the Romans, perhaps Jesus’ death caused him to doubt everything. He may be in a state of denial, like Peter, but deeper.
Whatever the case, he returns to the upper room the disciples tell him that Jesus is alive. Jesus is “more than alive,” he has risen from the dead to a new kind of life. Whatever the reason, when he is told that Jesus rose from the dead, he refuses to believe without further evidence. Thomas gets a bad reputation as a skeptic for not believing what the disciples told him.
On the other hand, there is virtually nothing in Second Temple Period Judaism that anticipated the death of the Messiah not his resurrection to eternal life. It was something which Thomas was not ready to believe since it was unbelievable within his world view. The disciples are making an extraordinary claim, that the messiah intended to die and rise to eternal life. This will require them to re-think virtually everything that they believe.
When Jesus appears in the midst of the disciples a second time, Thomas believes and confesses Jesus as “Lord and God” (verse 28). Thomas’s confession is a theological statement for the whole book of John. The writer has been slowly revealing who Jesus is through a series of misunderstandings, people hear Jesus’ words but do not fully comprehend his meaning. Even after the resurrection, Mary thinks Jesus’ body was stolen, then the disciples wonder if he ever really died. Even when he appears to them, they still do not confess Jesus quite the way Thomas does in verse 28.
John therefore intends Thomas’s words as a final word on who Jesus is: he is the “Lord and God” of the reader, and that by believing that he is the Lord one can have eternal life in his name (verse 31).