When considering this question, it's important to note that Antigone is the final play of Sophocles's Oedipus trilogy and takes part within a wider mythical context that the audiences of the time would have been familiar with. In Oedipus Rex, the city-state of Thebes is suffering from a terrible plague, whose cause is Oedipus's unwitting actions in murdering his father and marrying his mother. Oedipus abdicates his throne, but this action plunges the city—still recovering from plague—into civil war, as his two sons vie for power. The civil war decimates the population and Creon, Oedipus's uncle/brother-in-law, steps in to take power and begin restoring the city to peace.
Knowing this context, Creon's declaration that he must be obeyed at any cost is eminently understandable. He has inherited a disaster and dares not brook any opposition if he hopes to return Thebes to some semblance of normality. As he says when he first appears on stage:
The gods, after tossing the fate of our city on wild waves, have once more righted it.
He further declares that, as the new ruler of Thebes, he takes the following stance:
I would not be silent if I saw ruin, instead of safety, marching upon the citizens. Nor would I ever make a man who is hostile to my country a friend to myself, because I know this, that our country is the ship that bears us safe, and that only when we sail her on a straight course can we make true friends [...] never will I allow the traitor to stand in honor before the just.
The Chorus accepts Creon's mandate with regard to the burial of Polyneices, despite the taboo against leaving a corpse unburied, for as they say:
That is your will, Creon, towards this city's enemy and its friend. And the power is yours, I believe, to make use of every law whatsoever, both concerning the dead and all us who live.
Where the difficulty comes in—and what is, of course, the pith of this play—is Antigone's vehement disagreement with Creon's command and rejection of his authority in this matter. Nobody has the right to deny a corpse a proper burial, as such a thing is abhorrent to the gods. As Antigone says to Creon after she is arrested:
[It] was not Zeus that published that edict [...] Nor did I think that your decrees were of such force, that a mortal could override the unwritten and unfailing statutes given us by the gods.
She also claims:
All here would admit that they approve, if fear did not grip their tongues.
It transpires that she is correct, and many people in Thebes found Creon's command shocking, but like Antigone's sister, Ismene, they opted to accept Creon's power over them in this matter rather than resist him. Creon cannot or will not see this fact, and the consequences are disastrous to his family. He is so determined to do things the way he believes is correct that his own son can't persuade him to change his mind. He says to Haemon:
[Whomever] the city may appoint, that man must be obeyed in matters small and great and in matters just and unjust [... There] is no evil worse than disobedience. This destroys cities; this overturns homes; this breaks the ranks of allied spears into headlong rout. But the lives of men who prosper upright, of these obedience has saved the greatest part.
Creon is stubborn and rigid but so is Antigone. Both of them are trying to do what they feel is right, and neither of them will admit of any nuance in the matter. Are the King's laws unjust when they contravene the laws of the gods? Or are the gods' laws unjust when to follow them would threaten the well-being of an entire city? Creon is aware of the taboo against leaving a corpse unburied; that is precisely why he has inflicted this punishment on Polyneices, as a deterrent to any remaining dissenters in Thebes. To him, the gods' laws are less important in this context than his need to maintain order.
Alas, as it turns out, Antigone is correct: the gods must be obeyed in all things, always, for theirs is the absolute power. Nobody, not even a king, can overrule the gods. The man who tries will bring down a terrible fate upon himself and those around him. Creon only realizes the extent of his error when he discovers his wife and son have both killed themselves as a consequence of his execution of Antigone. He is appalled to see how wrong he got things, and says:
Ah, the blunders of an unthinking mind, blunders of rigidity, yielding death! [...] What misery arises from my reasonings!
The Chorus sadly agrees, saying:
Ah, how late you seem to see the right!
The play closes with the Chorus reinforcing the moral, which is that "our dealings with the gods must be in no way unholy." Creon thought his authority was superior to the gods', and this was a fatal mistake.