The situation in this story is that the Union army has invaded deep into the South. They have gotten near to Farquhar's plantation. He does not like this and he wants to do something to fight back against them.
What Farquhar does is to try to sabotage the bridge that crosses Owl Creek. According to the laws of war, it is illegal to try to commit sabotage unless you are in the uniform of your country's armed forces. Otherwise, you are a spy and you are liable to be executed.
Of course, the guy who egged Farquhar into doing it was committing an illegal act since he wasn't in uniform, but he didn't get caught.