Rape is never justified regardless of the past history of the victim.
The fruit of action is from Him, this being the logical position
Brahma Sutra III.ii.38
Only Ishvara distributes the fruits of Karma. Ishvara has not given any Jiva the right to claim that a victim deserved being raped.
Moreover, is it even correct to claim that the victim was raped because of past deed? The answer is no. There are two factors that affect the life of a Jiva. The first factor is past karma and the second factor is suffering inevitable in life called tapatraya regardless of one's karma.
What is Tapatraya?
Adhibhautika, adhidaivika and adhyatmika are known as Tapatraya.
The three words respectively mean: pertaining to (a) the bhuta or living
beings; (b) the daiva or fate, unseen forces and gods; (c) the body
(and the mind).
Sorrow and suffering (duhkha, tapa) are inevitable in life. In fact,
they are a part of life. A knowledge of their origin, causes and even
categorisation helps one to minimise their effect if not eradicate
them. The Hindu religious works usually call them 'tapatraya', 'the
three miseries'. They are: adhyatmika, adhidaivika and adhibhautika.
The adhyatmika duhkha or tapa is that which is caused by bodily
suffering and mental anguish. Hereditary diseases like leprosy,
disabilities like blindness or lameness and diseases caused by the
violation of the rules of health and sanitation are classed under
this. The mental agony caused by worries and anxieties, attachment
and aversion, also comes under this group.
The adhidaivika duhkha or tapa is that which is caused by daiva. The
word daiva includes the power of time, nature and the unseen hand of
fate. Diseases caused by the changing seasons, misery caused by the
elemental forces like floods and fire, suffering caused by black magic
or gods who are displeased, natural tribulations due to hunger, thirst
and old-age belong to this group.
The adhibhautika duhkha or tapa is that which is caused by other
bhutas or living beings, like wild animals, snakes or enemies.
Some of these, like hereditary diseases or physical disabilities
cannot be got rid of. Hence they must be endured. Some like the
diseases caused by change of seasons or the machinations of enemies
can be countered by taking appropriate precautions. However, raising
the mind to the level of the spirit, thus transcending the limitations
imposed by the body-mind complex, is the best solution to offset the
effects of tapatraya.
A Concise Encyclopedia of Hinduism by Swami Harshananda
What does this mean? Isn't Karma the only thing that governs life?
It means that if you consider life as a theater then you also have to consider the effect of the stage in which life is lived. Karma is certainly one factor but the world we live in is also a factor. I will give two examples of the world playing a role in our lives. We have lived through a pandemic since the beginning of 2020. Everyone regardless of their karma has suffered at least mental anguish due to this pandemic. Another example is the change brought about by the discovery of antibiotic. Before the discovery of antibiotic everyone regardless of their karma would have to suffer diseases due to bacteria. This suffering has been greatly reduced due to the discovery of antibiotic. So one cannot say that karma is the only factor that determines experiences.
The world is a dangerous place to live in regardless of one's karma. The theory of Karma cannot alone satisfactorily explain events such as genocide seen in the last century. Did the 2 million murdered Cambodians or the 6 million gassed Jews all deserve this? Did the colonised Indians deserve the colonisation? One is pretty much forced to bring in the dangerous nature of the world to explain industrial scale oppression. The only way to avoid the dangers of this world is by attaining moksha.
Dangerous World – Need for Moksha
"That Ocean, so terrible has sorrow for its waters. Anxiety and grief
constitute its deep lakes. Disease and Death are its gigantic
alligators. The great fears that strike the heart at every step are
its huge snakes. The deeds inspired by Tamas are its tortoises. Those
inspired by Rajas are its fishes. Wisdom constitutes the raft for
crossing it. The affections entertained for objects of the senses are
its mire. Decrepitude constitutes its region of grief and trouble.
Knowledge..is its island. Acts constitute its great depth. Truth is
its shores. Pious observances constitute the verdant weeds floating on
its bosom. Envy constitutes its rapid and mighty current. The diverse
sentiments of the heart constitute its mines. The diverse kinds of
gratification are its valuable gems. Grief and fever are its winds.
Misery and thirst are its mighty eddies. Painful and fatal diseases
are its huge elephants. The assemblages of bones are its flight of
steps and phlegm is its froth. Gifts are its pearl-banks. The lakes of
blood are its corals. Loud laughter constitutes its roars. Diverse
sciences are its impassibility. Tears are its brine. Renunciation of
company constitutes the high refuge (of those that seek to cross it).
Children and spouses are its unnumbered leeches. Friends and kinsmen
are the cities and towns on its shores. Abstention from injury and
Truth are its boundary line. Death is its storm-wave. The knowledge of
Vedanta is its island (capable of affording refuge to those that are
tossed upon its waters). Acts of compassion towards all creatures
constitute its life-buoys, and Emancipation is the priceless commodity
offered to those voyaging on the waters in search of merchandise. "
**Mahabharata Santi Parva Section CCCIII
Is Ishvara sanctioning violence on hapless victims?
The answer is no according to the Gita.
Resorting to Prakrti, Nature, which is My own Power, I send forth
again and again this multitude of beings that are without any freedom,
owing to Nature's sway over them.
These activities do not in any way bind Me, because I remain detached
like one unconcerned in their midst.
Doesn't good karma protect completely a Jiva from suffering in this world?
No, only persons practicing spiritual disciplines are assured of protection.
Whoever, being devoted to me solely, engage themselves always in
contemplation and worship of Me - to such ever steadfast devotees I
ensure the procurement of all their wants (salvation) and the
preservation of their assets.
Hence we can not even be sure that a victim deserved rape because of her past. It might be adhibhautika duhkha. Given this uncertainty it is not wise to even think of any metaphysical reason behind the suffering of a person. Leave that to the all-knowing Ishvara and concentrate on serving the victim and reducing her suffering.
Doesn't this explanation make the violence of the world a random event?
Yes, to a jiva it will appear to be random. It will not appear to be random to Ishvara.
This universe, which is the grossest of the gross entities, is the
form of the Lord. In this Cosmic Form all the past, the present and
the future subsist. Permeating this universal cosmic form, with its
seven sheaths - consisting of five elements, egoism, and the universal
intelligence - there is the Viratpurusha - the Cosmic Divinity. He is
the real object of concentration.
Srimad Bhagavata Purana II.1.24-25