Can a person sleep with his wife while he is fasting? Will the fast be broken if he did? What is the punishment for it if he knew and still did it?
All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
It is forbidden for a husband to have sex with his wife while fasting during Ramadan daytime. Indeed fasting means refraining from eating, drinking, having intercourse, etc, and having the intention of worshipping Allah. Fasting starts from dawn and finishes just after sunset.
Now, when the sun goes down (sets), the fasting person is allowed to do any lawful thing that was forbidden to him/her during Ramadan daytime. Allah Says (what means): {So now, have relations with them and seek that which Allah has decreed for you. And eat and drink until the white thread of dawn becomes distinct to you from the black thread [of night]. Then complete the fast until the sunset.} [Quran 2:187]
Moreover, fasting is an education of the soul that elevates it from the frequent practices related to the physical desires in order to strengthen its resolution and will. While fasting the Muslim frees himself of these desires and does not remain their prisoner during his/her whole life. This helps him/her reach the sublime objective which is fearing Allah and observing His Commands in private and publicly. Allah Says (what means): {…that you may become righteous….} [Quran 2:21]
As for the person who breaches the sanctity of Ramadan by having intercourse with his wife while fasting, he has invalidated his fasting and that of his wife and he has committed a major sin which exposes him to the Wrath of Allah as well as His Punishment in this world and the Hereafter unless he (this person) hastens to repent sincerely to Allah begging His forgiveness. In case the person persists in committing the sin after knowing the ruling, the prohibition becomes more emphatic and the Muslim authorities should punish him to deter him from repeating this obnoxious sin which proves weakness in faith and heedlessness in following the Sharee’ah orders and avoiding its prohibitions. In addition, he/she will have to expiate for this bad deed by doing one of the following things for each missed day: freeing a slave, or fasting two consecutive months, or feeding sixty people. The Maaliki School of jurisprudence held that the person may choose any of the above expiations. But the majority of scholars believe that the person does the first option if he able to, otherwise he does the second one, and if he again cannot, then he does the third one.
Allah knows best.
You can search for fatwa through many choices