From a historical perspective one has to understand a few things.
One: We live in a time of such safety and ease that our ancestors would not be able to fathom it. Cities used to have walls, because entire villages and cities were always at risk of rape and pillaging. Avraham Avinu consistantly told people Sarah was his sister for fear people would murder him to take his wife, because to according to ancient world laws, it was a greater offense to sleep with someones wife than to kill someone if that person was an outsider. And so if you wanted to sleep with his wife, it your best bet was to kill him, THEN sleep with her.
Two: We live in a time where women have freedoms, resources, and respect that the ancient world could have never dreamed. Without getting into a huge debate about it, women were basically considered financial burdens in the ancient world. They had to always be kept inside and protected for fear someone will see them, take them, rape them, and then move on. They were almost never allowed to go to work. Father's paid other men dowry's to marry their daughters to incentivize someone taking her off his hands, so that she could be supported by someone else. And if that husband died, then the eldest male child would support her. And the list goes on.
Three: We see sex, virginity, and purity drastically differently, and rape is so rare nowadays we don't talk about its repercussions in relationships. Many men have a hard time getting intimate with their girlfriends/wives after they've been raped. But in the ancient world, nearly no one was willing to marry a non virgin. When a woman was raped in the ancient world, her life was literally over. She would more than likely never get married, never leave her fathers household, and if her father died, she would also likely die. This reality helps shed light on why God is there for the poor, the orphans, and the widows, and why the brother of the widow who has no children has to attempt to marry her. Because the poor have no resources and can't move up in the world, the orphans have no support, and a widow has no virginity and therefore little worth in the world. A woman without her virginity was like a person without eyesight, or hands, or feet. Severely disabled, at a great disadvantage, and likely to die.
So this law was probably instituted to help women, in the following way. If someone raped her, he had basically ended her life, as she would never marry and would lack any financial support. Therefore he was punished with the responsibility of providing for her for the rest of his life, and she was rewarded with the safety and security of a husband who would support her. This sounds completely crazy and insane to us now, and it should. Because we have thankfully moved on as a civilization where we no longer need these kinds of laws now. A woman can find a husband, whether she was raped or even if she just had prior sexual partners. Women can work for themselves, women can inherit and invest money, governments have welfare and aid programs, etc.