If he has intercourse but does not ejaculate, ghusl is still required
Question

If intercourse takes place but climax (emission of semen) is not reached, do they both have to take a bath? If they do not feel any desire, can they resort to the secret habit?.
Praise be to Allah.Firstly: 
If intercourse takes place, i.e., if the tip of the penis disappears in the vagina, then ghusl is obligatory for the man and the woman, even if no semen is emitted, because of the report narrated by al-Bukhaari (291) and Muslim (348) from Abu Hurayrah (may Allah be pleased with him) from the Prophet (peace and blessings of Allah be upon him) , who said: “When a man sits between the four parts (arms and legs of his wife) and has intercourse with her, then ghusl is obligatory.” 
Muslim added: “Even if he does not ejaculate.” 
Ibn Qudaamah (may Allah have mercy on him) said in al-Mughni (1/131): The fuqaha’ are agreed that ghusl is required in this case, except that it was narrated that Dawood said it is not required. End quote. 
Secondly: 
It is permissible for a man to enjoy his wife and for a woman to enjoy her husband, however they want, so long as they avoid intercourse at the time of menstruation and anal intercourse.  That includes each of them masturbating the other. This comes under the heading of enjoyment that is permitted according to the verse (interpretation of the meaning):  
“And those who guard their chastity (i.e. private parts, from illegal sexual acts)
6. Except from their wives or (the slaves) that their right hands possess, ___ for then, they are free from blame” [al-Mu’minoon 23:5-6]
But if a man masturbates by himself or a woman masturbates by herself, this is haraam. That has been explained in the answer to question no. 329. 
And Allah knows best.