Frequently, you make it as painful and explicit as possible.
One of the most compelling ideas I've heard about art in general, including writing, is that each piece of work has a gesture, or overarching goal that it's trying to achieve. The gesture can be anything - a theme, a particular artistic technique, an experience for the reader, etc. For a romantic comedy movie, the primary gesture to be funny and let the audience enjoy themselves. For a Jackson Pollock painting, it's to get viewers to focus on the abstract yet nevertheless aesthetically pleasing ideas of color and texture. For The Chronicles of Narnia, it's to explore Christian ideas in an imaginative, inviting setting.
For a movie like The Big Short, it's to make the audience aware of how galling the financial crisis of 2008 was and generate moral indignation. For The Passion of the Christ, it's to portray how horrible Jesus' suffering was as described in the Bible. For a book like Lord of the Flies, which includes a violent allegorical rape scene, a character having a religious experience with Satan, and a ritualistic murder, the point is to show humanity at its worst.
In all of these examples, pleasant and distrubing, the artists behind the works decided what the primary focus of their piece was and did everything they could to make that experience as direct and compelling as possible.
What this means is that when you're writing a passage that deals with a disturbing or violent situation, then for better or for worse, the disturbing and violent incident is your gesture. To make the scene as compelling as possible, it's best - although often very emotionally difficult - to lean into the pain, not to shy away from it.
This is tempered by the overall goal of your writing. If you're writing a whimsical fantasy story and it involves, for plot reasons you decide not to work around, a rape scene, then the overall gesture of a fun adventure trumps the pain of the specific scene. It makes sense to tone that scene down.
As another example, the book A Fine Balance is about a group of people living in India whose lives are torn apart by political forces and hateful bigots outside their ability to control. The gesture of the book is arguably to make the reader aware of how brutal life was for many Indians during a specific point in the nation's modern history. The book involves multiple very violent and explicit rape scenes. In line with the book's particular overall gesture, these rape scenes do not shy away from the extraordinary pain the characters are put through. But the scenes emphasize the victims' pain and experiences, not the eroticism of the sex. I bring this example up because Mark Barker's answer suggests that if you write your scenes too explicitly, you invite readers to sadistically enjoy the characters' pain. I disagree with this. You'll certainly make your readers uncomfortable - A Fine Balance is an extremely disquieting novel - but you can focus your writing in a way that focus your gesture on the human meaning of the events of your story, not on violent or sexual voyeurism.
For your particular situation, is your story's gesture to make the reader aware of how brutal abusive relationships can be, or to celebrate a victim overcoming abuse? The former gesture demands you don't shy away from the main character's pain. The latter gives you space not to make things so painful that readers are too uncomfortable to keep reading.