In fact, Islam forbids not only illicit sexual intercourse, but also forbids anything that can lead to this sin and crime. The Prophet (peace and blessings be upon him) said, “Eyes commit adultery, ears commit adultery, hands commit adultery, and feet commit adultery, and the private part either consummates it or repudiates it.”
Thus, Muslims should avoid any avenue of zina (illegal sexual intercourse). Almighty Allah says, (Do not go anywhere near adultery: it is an outrage, and evil path) (Al-Israa’ 17: 32). Thus, Allah, in the Qur’an, not only prohibits zina, but He also prohibits even coming close to it.
apparently, what your friend did, though being extremely abominable, is not regarded as actual zina because zina must include real sexual intercourse which is not found here. Zina means a real sexual intercourse between unmarried man and woman.
Your friend has to repent and turn penitent to Allah and beseech His Forgiveness, and resolve firmly never to commit such sin again, exactly as the milk never returns back to the udder.
Allah says, “Didn’t they know that it is Allah who accepts repentance of His servants and forgives sins?” (At-Tawbah: 104). The Prophet (peace and blessings be upon him) said, “Allah accepts the repentance of a person as long as death has not reached his collar bone (i.e., as long as it is not done in the last pangs of death ).”
Sincere repentance, however, is not simply saying, “Lord, forgive me”, “I ask forgiveness of Allah.” Sincere repentance involves experiencing within oneself a profound sense of guilt for having disobeyed Allah and for the terrible sin one has committed. Secondly, one should totally refrain from approaching that sin as well as from such associations and circumstances that may led him/her to it; thirdly, one must be resolved never to repeat the same in the future.
Once the above procedures are followed, we can look forward to Allah’s forgiveness for He is certainly All-Merciful and All-Forgiving.
having said this, it is important to point out that if a person has sinned in the past, he/she must continue to be vigilant, and remember that Allah Sees all that we do. The person should try to visualize heaven and hell as if they are in front of them. That is the only way to check one’s carnal desires.
May Allah guide all of us to what pleases Him!