Oedipus Rex is set in the ancient Greek city-state of Thebes. Or, to be more precise, it's set in front of the Theban royal palace. Ancient Greek playwrights were sticklers for the three unities of time, subject, and place, and Sophocles was no different. That being the case, the setting doesn't change throughout the play. Despite this, much of the important action takes away from the palace exterior. For instance, we never actually see Oedipus gouge his own eyes out; he does it off-stage. Such acts of violence and bloodshed were traditionally presented as occurring off-stage in ancient Greek drama, largely due to practical constraints.
The setting of Oedipus Rex forms a focal point for the members of the audience, encouraging them to concentrate on the action, to which they must pay particularly close attention. At the same time, the very simplicity of the setting allows the audience members to use their imaginations to add more richness and depth to the unfolding drama.
The setting of Oedipus Rex is the steps in front of the royal palace at Thebes. This play adheres to Aristotle's unity of place, meaning that all the action takes place in just one setting; his unity of subject, meaning that there is just one main story and not little stories of lesser importance in addition to the main one; and his unity of time, meaning that all the action takes place within a 24-hour frame. Oedipus first meets the Chorus out on the steps, and they are bemoaning the terrible state of things in Thebes when the play begins. Oedipus has already sent Creon, his brother-in-law, to the oracle at Delphi, and Creon returns (during the play) in order to report what the oracle has said. Anything that does not occur on the steps, such as Jocasta's eventual suicide, which takes place indoors, must be reported by a messenger, and anyone who is needed to corroborate a story or provide details must be brought to the palace steps to speak.