Its being disliked is due to the fact that it dissolves a marriage that, by its very nature, secures the benefits the Sacred Law intends.
Divorce becomes recommended when real need arises—namely, when remaining married would harm the wife. This occurs, for example, in cases of chronic discord between the spouses or when the wife has come to detest her husband; for persisting in the marriage under such circumstances is detrimental to her. The Prophet ﷺ said, “There must be neither harm nor reciprocating harm.”
Divorce is obligatory for the husband when the wife is religiously wayward—such as habitually abandoning the prayer, delaying it beyond its time, or acting with moral indecency—and he is unable to reform her. In the soundest of the two opinions, he must divorce her in that state.
Shaykh al-Islām Ibn Taymiyyah (d. 728 AH) said, “If she is committing fornication, he is not permitted to keep her as his wife; otherwise he would be a dayyūth (a man who tolerates indecency in his household).”
Likewise, if the husband himself is not upright in his religion, the wife is obliged to seek separation—either by requesting a judicial divorce or by initiating khulʿ with compensation—so that she does not remain with a man who is neglectful of his faith.
The husband is also duty-bound to divorce if he has taken an oath of īlāʾ—vowing to abstain from marital relations—four months have elapsed, and he still refuses both to resume intimacy and to expiate his oath. At that point he must be compelled to pronounce the divorce, in accordance with the Divine statement: “For those who forswear their wives, a waiting period of four months is ordained. If they return, Allah is All-Forgiving, All-Merciful; but if they resolve upon divorce, Allah is All-Hearing, All-Knowing.” (Quran 2:226-227)