Plato once wrote a short dialogue called "The Ring of Gyges". It featured two characters called Glaucon and Socrates (Socrates was Plato's teacher but Plato often used him as a character in his dialogues) who demonstrate why there is no reason to have such a high respect for what we call justice. Glaucon is the instrument for voicing this opinion, and he does this by first offering a theory on the nature of the origin of justice:
"They say that to do wrong is naturally good, to be wronged is bad, but the suffering of injury so far exceeds in badness the good of inflicting it that when men have done wrong to each other and suffered it, and have had a taste of both, those who are unable to avoid the latter and practise the former decide that it is profitable to come to an agreementwith each other neither to inflict injury nor to suffer it. As a result they begin to make laws and covenants, and the law's command they call lawful and just. This, they say, is the origin and essence of justice; it stands between the best and the worst, the best being able to do wrong without paying the penalty and the worst to be wronged without the power of revenge"
In simple words, he thinks that justice comes from the laws that we create so that we can avoid being harmed. These laws are only created because we would rather give up our ability to wrong others, than be wronged by others.
So, if you possessed a magical ring - the ring of Gyges - that makes you invisible when you put it on, would it be foolish to keep abiding by the law? Glaucon suggests that we shall be able to make a correct judgement about it only if we consider the most just man, and the most unjust man.
For the most just man: we must take away his reputation, for a reputation for justice would bring him honour and rewards, and it would not be clear whether he is being just for the sake of justice, or for sake of the benefits he will recieve from being just. Though he does no wrong, he must have the greatest reputation for wrongdoing so that he may be tested for justice by not weakening under ill repute and its consequences.
For the most unjust man: someone who is caught must be considered a poor performer, for the extreme of injustice is to have a reputation for justice, and our perfectly unjust man must be granted perfection in injustice...
Glaucon concludes: "and let them be judged as to which of the two is happier."
By comparing the most just man and the most unjust man, we can see that there is no reason why the laws should be obeyed for their own sake. However, it makes sense for the owner of the ring to keep obeying the laws if doing wrong would leave them with unwanted feelings such as guilt. Another way that we could argue against Glaucon is to reject the nature of the origin of justice. It suggests that we are selfish beings who are prepared to do wrong to others if it will benefit ourselves. For a further discussion of this, see Are we really that selfish?.
If you are interested in reading Plato's dialogue, see The Myth of Gyges.