Blindness is a motif that recurs again and again throughout Oedipus Rex. For most of the play, Oedipus is figuratively blind, meaning ignorant, whereas the literally blind Tiresias has knowledge of the future. Tiresias eventually communicates his knowledge to Oedipus, but he does so through a riddle that Oedipus is unable to decipher, once more evidencing Oedipus's ignorance.
Oedipus does eventually learn the truth of his family and the prophecy, but after doing so he feels compelled to blind himself. Like Tiresias, the now-blind Oedipus can finally see the truth. Oedipus's gouging out of his own eyes is a self-inflected contrapasso, or a punishment uniquely befitting of the crime. As Oedipus explains, "Too long you looked on the ones you never should have seen, blind to the ones you longed to see, to know! Blind from this hour on!" Oedipus was so blind to his own failings and is now so overcome by how ignorant he was that he feels compelled to literalize that figurative blindness and gouge out his own eyes accordingly.
Ironically, the audience is not blind, due to both Sophocles's foreshadowing and their general knowledge of Oedipus's story. Thus the fact that Oedipus Rex is a play—a visual performance—furthers the motif of blindness.