All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
We beseech Allaah The Exalted to grant you wellness and help your husband through his suffering. Bear in mind that imagining uttering the words of divorce does not affect the validity of the marriage; therefore, your marriage is valid and effective. Moreover, your husband should eschew such evil obsessions and imaginations and should not give the devil the chance to manipulate him; for it might be taken to the worst level and the devil might whisper to him about his beliefs, religion, and acts of worship. Hence, you should put an end to this before things get out of control.
Seeking refuge in Allaah The Almighty and turning towards Him seeking His Help especially during the times of these evil whisperings would help you overcome this problem.