The penalty for rape in Maycomb, according to Atticus, was the death penalty. Atticus says:
"You know rape’s a capital offense in Alabama."
From this perspective, the characters in the book believe that Tom would die. They all come to this conclusion, based on what they know about Maycomb. Externally, Maycomb may look perfect, but inwardly the citizens of Maycomb are racist. Therefore, the words of a black man will never win over the words of a white man. In view of this great injustice, it is not shocking that Tom would be found guilty and eventually face the death penalty.
However, what is shocking is that Tom died so quickly in prison. According to the prison, Tom tried to escape. They shot him seventeen times, which seems very suspicious.
From a reader's perspective, there is an inkling that things would not go well in prison. Racism is ugly and violent. So, when Tom went off to prison, it is not surprising that he was shot and killed. That said, I don't think we can say that the needed to die, but that he died is not surprising.