Is it legal to retaliate against an employee who answered falsely when asked an illegal question?
It depends. It is important to ensure we understand the distinction between (1) questions which are illegal in and of themselves, and (2) the illegality of hiring, discharging, or failing to hire based on a candidate's/employee's answer(s) or attributes. You yourself might have been aware of the difference beforehand, but your question is a good occasion for clarifying a general misconception.
In instances of the first category, it would certainly be illegal to retaliate against the employee insofar as the falsehood is traceable to the employer's violation of the law. Examples of this category are sections 432.3(b) ("An employer shall not [...] seek salary history information, including compensation and benefits, about an applicant for employment") and 432.7 ("An employer [...] shall not ask an applicant for employment to disclose, through any written form or verbally, information concerning an arrest or detention that did not result in conviction") of the California Labor code.
Scenarios of the latter category are more intricate, since an employer might prove that his decision to discharge the employee falls outside of conduct sanctioned by statute. For instance, 42 USC § 2000e-2(k)(1)(A)(ii) does not outlaw --at least at a federal level-- questions about the individual's protected categories (such as sex, religion, or national origin). It only outlaws the decision making that is influenced by the protected categories which are the subject matter of the interview questions. The example you gave ("what would your husband do if you got this job?") serves to illustrate the difference, putting aside that questions of that sort might be intended to indirectly ascertain the candidate's marital status.
Let's assume that the employer seeks to hire a waitress, and that the jurisdiction at issue outlaws discrimination on the basis of employee's marital status but not the questions about it.
The employer has a cognizable interest to avoid employing any waitress whose husband is an overly jealous person with propensity to attack male clients. The waitress's lie when answering that question (for instance, by fraudulently representing that she is single or that her husband is ok with her employment as waitress there) contravenes the employer's legitimate interest to protect its clients.
In that context, the employer's discovery that the employee lied during the interview gives reasonable grounds for discharging that employee. After all, the employee's intentional misrepresentation only strengthens the employer's suspicion of being at greater risk (of liability toward clients) than the employee is willing to admit.
For the employer to prevail at law, it would need to be proved that the reason for discharging the female employee was not her marital status itself, but the employee's concealment of a risk that is a matter of employer's lawful concern.