Coercion is duly considered by Islamic Sharia as a valid excuse for basically foregoing sins and mostly remitting their consequences. Rape is a brutal type of coercion the victim of which is not only forgiven but also sympathized with.
Sheikh Muhammad Salih Al-Munajjid said:
Rape implies force and coercion, and the one who is forced to do something will not be held accountable for it. Allah says, (Whoever disbelieved in Allah after his belief, except him who is forced thereto and whose heart is at rest with Faith; but such as open their breasts to disbelief, on them is wrath from Allah, and theirs will be a great torment) (An-Nahl 16: 106)
This noble verse indicates that those who speak words of kufr (disbelief) because they are forced to do so are free of sin and blame, so long as their hearts remained at rest with faith. If this is the case with kufr, which is the most grievous of all haram things, then it applies even more so to things that are less grievous and the person who is forced to do them is not held accountable for them.
The Prophet (peace and blessings be upon him) said: “Allah has forgiven my ummah for mistakes, forgetfulness and that which they are forced to do.” (Ibn Majah)
So, if a woman who was raped did her utmost to resist, but she was not able to escape, there is no sin on her; her fast is valid and she does not have to make it up or offer any kaffarah (expiation).
Imam Ahmad (may Allah have mercy on him) said, “Everything that overwhelms a fasting person, he does not have to make it up nor has he to do anything else.” (Al-Mughni, 4/376)
But concerning the ruling of a woman who had intercourse during the daytime in Ramadan sheikh Ibn `Uthaymeen said, “If the woman is excused because of ignorance or forgetfulness, or because she was forced to do it, then she does not have to make it up and she does not have to offer expiation.
Finally, we advise women to fear Allah and to avoid mixing with men, especially non-Muslims and the immoral ones among them, and to keep away from everything that may attract men to them including tabarruj (wanton display of beauty), soft and flirtatious speech and behavior. They should choose suitable times and avoid doubtful places or situations. They should adhere to the commands of Allah, observe hijab and cover themselves, because that will protect them and is good for them in this world and in the hereafter.