Short answer. The just cause the law names is willful disobedience of an employer's lawful orders connected with your work. An order that would require you to break the law is not a lawful order, so refusing it does not fit this specific ground as the statute words it.
What the law says
Serious misconduct or willful disobedience by the employee of the lawful orders of his employer or representative in connection with his work
Labor Code, Article 282 — Just Causes For Dismissal. Read the full provision →
The ground is tied to lawful orders specifically
The just cause reads: serious misconduct or willful disobedience by the employee of the lawful orders of his employer or representative in connection with his work. The word lawful is doing real work in that sentence. It is disobedience of lawful orders that the provision treats as a just cause, not disobedience of any order regardless of its content. The article also does not, by its own text, describe what happens if an employer dismisses someone anyway for refusing an unlawful order — that consequence is worked out under the general rules on illegal dismissal, not spelled out within Article 282 itself.
The order also has to connect to the work
Beyond lawfulness, the order also has to be in connection with his work, meaning it relates to the employee's job duties. An instruction unrelated to the employee's actual work responsibilities sits outside the scope of what this ground describes, quite apart from whether following it would require breaking the law. Two separate questions are therefore in play whenever this ground is invoked: was the order lawful, and did it actually relate to the work the employee was hired to do.
Serious misconduct is the other branch of the same ground
The same clause also names serious misconduct as a separate basis alongside willful disobedience. These are two distinct routes to the same just cause, and an employer relying on this ground for a dismissal would need to be pointing to one or the other, misconduct on the employee's part, or disobedience of an order that was actually lawful and work-related, rather than simply any refusal to comply with an instruction.
The article carries three further causes — gross and habitual neglect of duty, fraud or willful breach of trust, and commission of a crime against the employer or his family — plus other causes analogous to the foregoing. An employer that cannot rest on disobedience sometimes recasts the same refusal as one of these, so it is worth reading the notice you were given to see which ground is actually being invoked.
What this means if you refused an order you believed was illegal
If the instruction you refused would have required you to break the law, that fact goes directly to whether the order was lawful in the first place, which is the very condition this ground is built around. Whether a specific order actually qualified as unlawful, and whether your employer characterized your refusal as misconduct on other grounds instead, are questions that turn on the exact instruction given and the exact facts of the refusal.
Two other points bear on it. The disobedience must be willful, so why you refused is part of what the ground examines, not merely that you refused; a refusal grounded in a genuine, stated belief that the instruction was unlawful is not defiance. And a just cause is only half of a valid dismissal — the Code separately requires the employer to put the ground to you in writing and give you a real opportunity to answer it before terminating.