Praise be to Allah.
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 Allah be upon him) said: “Obedience is only with regard to that which is right and proper.” Haram 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 haram and is not permitted, and she should explain the evidence for that. The questioner does not explain what the haram 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 haram action, because obedience to Allah takes precedence over obedience to her husband. She should strive and seek reward, and turn to Allah and pray to Him and beseech Him to guide her husband away from such deeds. For du’a is a mighty weapon, and Allah will not turn away one who asks of Him.
Moreover, she can buy him some books or tapes, and seek the help – after Allah – 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 Allah, and encourage him by telling him that whoever gives up something for the sake of Allah, Allah will compensate him with something better.