In the case of zina, the hadd punishment is conditional upon penetration, which means that the head of the penis disappears into the vagina. If it does not penetrate it or only part of it penetrates it, then he is not subject to the hadd punishment.
It says in al-Mawsoo’ah al-Fiqhiyyah (24/23), explaining the conditions of the hadd punishment for zina on which the fuqaha’ are agreed: There is no difference of opinion among the fuqaha’ that in order for the hadd punishment to be incurred, the head of the penis has to disappear into the vagina. If it does not enter it at all or only part of it enters, then there is no hadd punishment because that is not intercourse. There is no stipulation that ejaculation must take place or that the penis must be erect at the time of penetration. The hadd punishment must be carried out whether he ejaculated or not, and whether his penis was erect or not. End quote.
The things that lead to zina such as touching, kissing, and rubbing the private parts together without penetrating do not come under the ruling on zina, and the one who does them is not subject to the hadd punishment, rather he is to be punished and disciplined because he has done something that is haraam and plainly evil, and because these actions may lead him to commit true zina. Islam calls these actions zina, as in the hadeeth which was narrated by al-Bukhaari (6243) and Muslim (2657) from Abu Hurayrah (may Allaah be pleased with him) from the Prophet (peace and blessings of Allaah be upon him) who said: “Allaah has decreed for the son of Adam his share of zina which will inevitably catch up with him. The zina of the eye is looking and the zina of the tongue is speaking. The heart wishes and longs and the private part confirms that or denies it.”
Ibn Battaal (may Allaah have mercy on him) said: Looking and speaking are called zina because they invite one to true zina. Hence he said: “the private part confirms that or denies it.” End quote from Fath al-Baari.
See also question no. 81995.
The one who has done such actions must repent to Allaah sincerely, by giving it up, regretting what he has done, resolving not to go back to it, and avoiding the causes and things that lead to that such as being alone with a woman, looking and shaking hands.
As for marrying that girl, if she is chaste and did not commit zina, or she did that but then repented to Allaah, then there is nothing wrong with marrying her. We do not find any evidence to suggest that this marriage will expiate this sin. Rather what will expiate it is repenting to Allaah and mending one's ways. Allaah says (interpretation of the meaning):
“And verily, I am indeed forgiving to him who repents, believes (in My Oneness, and associates none in worship with Me) and does righteous good deeds, and then remains constant in doing them (till his death)”
It is not correct to say that approaching a haraam deed is like doing it. Rather this is subject to further discussion.
If a person thinks of doing an evil deed then refrains from it, he will be rewarded, as it says in the hadeeth narrated from Ibn ‘Abbaas (may Allaah be pleased with him) that the Prophet (peace and blessings of Allaah be upon him) said, relating from his Lord, may He be glorified and exalted: “Allaah decreed good deeds and bad deeds, then He explained that. Whoever thinks of doing a good deed then does not do it, Allaah will write it down as one complete good deed. If he thinks of doing a good deed and then does it, Allaah [may He be glorified and exalted] will write it down between ten and seven hundred fold, or many more. If he thinks of doing a bad deed then he does not do it, Allaah will write it down as one complete good deed, and if he thinks of it then does it, Allaah will write it down as one bad deed.”
Narrated by al-Bukhaari (6491), Muslim (131)
If he thinks of doing an evil deed and resolves to do it, and starts to do it, or tries to do it, but is not able to complete it due to external factors, then he is sinning and is not rewarded, as is indicated by the hadeeth: “If two Muslims confront one another with their swords then the killer and the victim will be in Hell.” I said: “O Messenger of Allaah, the killer’s (case is clear), but what about the one who is killed?” He said: “He was keen to kill his companion.” Narrated by al-Bukhaari (31), Muslim (2888).
Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him) said: This hadeeth gives the answer to the question of whether a person will be accountable for what he intends to do. Some people say he will be accountable for it if his intention reached the level of resolve. Some say that he is not accountable. The answer is that if the intention reaches the level of resolve, then it must be accompanied by some words or deeds (in order for a person to be accountable for his intention). End quote.
Those who said that he would be accountable for his intention quoted as evidence the words of the Prophet (peace and blessings of Allaah be upon him), “If two Muslims confront one another with their swords then the killer and the victim will be in Hell.” But this is not evidence that one will be accountable merely for thinking of it, for he said that about two men who each fought with the intention of killing the other, but this is not merely resolve, rather this is resolve accompanied by action, but he was unable to complete his goal. This person will be accountable according to the consensus of the Muslims. If a person strives to drink alcohol and tries by his words and deeds to do that but fails, he is a sinner according to the consensus of the Muslims. He is like one who drinks even if he does not drink. Similarly if a person strives to commit zina or steal and so on, in his words and deeds, but fails to do it, then he is a sinner like the one who does it. The same applies to murder, and so on. End quote from Majmoo’ al-Fataawa (14/122).
This applies if the sin is committed and incurs punishment in the Hereafter. As for the punishment that results from committing sins in this world, such as the hadd punishment for zina, he is not to be punished in this manner except if he commits true zina, not if he tries to commit zina but fails.
And Allaah knows best.