Almighty Allah says in the Qur’an: “Your wives are a tilth for you, so go to your tilth (have sexual relations with your wives in any manner as long as it is in the vagina and not in the anus), when or how you will, and send (good deeds, or ask Allah to bestow upon you pious offspring) for your own selves beforehand. And fear Allah, and know that you are to meet Him (in the Hereafter), and give good tidings to the believers (O Muhammad).” (Al-Baqarah: 223)
In the foregoing verse the word harth (tilth) indicates that only vaginal sex is permissible in Islam, because it is from this place children are produced. The semen lodged in the womb from which offspring comes is likened to the seeds that are planted in the ground, bringing vegetation. Both of them are substances from which something else is produced.

All Muslim jurists agree that anal sex is haram (prohibited), based on the hadith of the Prophet (peace and blessings be upon him): “Do not have anal sex with women.” (Reported by Ahmad, At-Tirmidhi, An-Nasa’i, and Ibn Majah.)
Khuzaymah Ibn Thabit (may Allah be pleased with him) also reported that the Messenger of Allah (peace and blessings be upon him) said: “Allah is not too shy to tell you the truth: Do not have sex with your wives in the anus.
(Reported by Ahmad, 5/213.)

Ibn `Abbas (may Allah be pleased with him) narrated: “The Messenger of Allah (peace and blessings be upon him) said: “Allah will not look at a man who has anal sex with his wife.” (Reported by Ibn Abi Shaybah, 3/529, and At-Tirmidhi classified it as an authentic hadith, 1165)

Further, it is reported that the Prophet (peace and blessing be upon him) referred to such an act as “minor sodomy”. (Reported by Ahmad and An-Nasa’i)

However, it is allowed to caress the wife and stimulate her around the anus, without having sex in this area. It is reported that `Umar Ibn Al-Khattab (ay Allah be pleased with him) came one day to the Prophet and said, “O Messenger of Allah, I am ruined!” “What has ruined you?” asked the Prophet. He replied, “Last night I turned my wife over,” meaning that he had had vaginal intercourse with her from the back. The Prophet (peace and blessings be upon him) did not say anything to him until the verse cited above was revealed. Then he told him, “[Make love with your wife] from the front or the back, but avoid the anus and intercourse during menstruation.” (Reported by Ahmad and At-Tirmidhi)
If one does have anal sex with his wife, he has committed a grave sin, which requires repentance. He should regret and feel contrite for committing such a sin. Allah Almighty destroyed a whole nation who were accustomed to this evil habit.
But, the wife is not considered divorced as many people think, because there is no evidence to support this view. However, scholars maintain that if a man habitually does this or insists on having anal sex with his wife, she has the right to ask for a divorce, because he is considered an evildoer who is causing harm by his action, and also because the purpose of marriage cannot be achieved through this action.

The wife has to resist this evil action and refuse to respond to her husband’s desire to have anal sex. She should remind him of Allah as well as the punishment of those who transgress the Bounds set by Him, Most High.