This is a great question. The role of the chorus in Sophocles play is very important. I will mention three roles.
First, the chorus acts as a voice of reason in Sophocles' play. The chorus, the towns people of Thebes, urge moderation. They try to impart the Greek virtue that all things should be done without excess. Of course, Oedipus will not listen, because he has a high view of himself.
Second, the chorus also evokes pity from the audience or reader. They are hungry, sick, and even on the verge of death. They are the ones that describe the situation that the city is going through. So, in a sense, we can say that they set the stage.
Third, by the end of the play the the chorus changes their view and begin to pity Oedipus. When they realize the truth about Oedipus, namely that he married his mother and killed his father, they can only feel compassion.