It says in al-Mughni by Ibn Qudaamah al-Hanbali: “Concerning a woman who was pursued by a man, and she killed him to protect herself, Ahmad said: ‘If she knew that he wanted [to rape] her, and she killed him to protect herself, then she is not at fault.’ Ahmad mentioned the hadeeth which al-Zuhri reported from al-Qaasim ibn Muhammad, from ‘Ubayd ibn ‘Umayr, in which it said that a man had visitors from [the tribe of] Hudhayl, and he wanted [to rape] a woman, so she threw a rock at him and killed him. ‘Umar said, ‘By Allaah, there is no diyah for him ever’ i.e., she did not have to pay the ‘blood money’ for him. If it is permissible to defend one’s money, which one can give away, then a woman defending and protecting herself and her honour which cannot be given away, is clearly more permissible than a man defending his money. If this is clear, then she is obliged to defend herself if she can, because letting someone overpower her [rape her] is haraam, and by not defending herself, she lets him overpower her.” [al-Mughni, 8/331]
IslamQA