We should note that there is no obedience to any created being if it involves disobedience to the Creator, as the Prophet (peace and blessings of Allaah be upon him) said: “Obedience is only with regard to that which is right and proper.” Haraam actions do not come under the heading of that which is right and proper, rather this is an evil deed, so if the husband threatens his wife and says that he will divorce her if she does not do it, she should try to explain to him and warn him that this is haraam and is not permitted, and she should explain the evidence for that. The questioner does not explain what the haraam deed is and to what degree it is forbidden. She should tell us what it is so that we can answer more clearly. But the basic principle is that she should not do it and that there is no obedience to any created being if it involves disobedience towards the Creator.
This woman should refuse to do the haraam action, because obedience to Allaah takes precedence over obedience to her husband. She should strive and seek reward, and turn to Allaah and pray to Him and beseech Him to guide her husband away from such deeds. For du’aa’ is a mighty weapon, and Allaah will not turn away one who asks of Him.
Moreover, she can buy him some books or tapes, and seek the help – after Allaah – of one of her relatives or one of the seekers of knowledge in her city, or the imam of a mosque, etc, to advise her husband and remind him of Allaah, and encourage him by telling him that whoever gives up something for the sake of Allaah, Allaah will compensate him with something better.