Hi, this is a great question!
TLDR:The short answer to this question is: yes, they most certainly can and did.
The church often provided avenues for women of the middle ages to not only leave their husbands, but sometimes gain more agency and esteem despite them. As this is a somewhat complicated question, I would like to bring up three specific medieval women that I believe would illuminate some of the complicated history that women shared with the church and marriage.
As a disclaimer, this would not have been the case necessarily for all women, as hagiographies and other medieval materials are often affected by selection bias, where the women we hear about from source material are those who were exceptional in their position or whose biographers saw value in recounting their stories. There was also great variety in church and church doctrine across Western Europe at this time, so to issue a blanket statement would be to do a disservice.
Radegund (520-587)-An Early Royal Source
Despite being outside of the time period, Radegund remains an important figure to mention in this question because of her high status and also presence of a detailed biography. Her life is recorded in a hagiography by the acclaimed Fortunatus, in which the exact circumstances of her escape from her husband’s court are illuminated. Radegund was a Thuringian noblewoman and one of several wives to Theuderic, married as a form of alliance building with the Merovingian court. After losing the last of her family members (and allies in the Frankish court), she fled, seeking refuge in Noyon. The timing of her flight from the court makes it clear that without a family member in the court, she was well within her rights to be concerned about mistreatment, having no value by blood and providing no children that might have elevated her status to Theuderic. Even with family members nearby she was not immune from mistreatment, when refusing to lie with her husband, Fortunatus mentions “Her goodness provoked him to harsher irritation but she either soothed him to the best of her ability or bore her husband’s brawling modestly.” These courtly politics are necessary to mention in order to understand the "push" forces that led her to the church. Fortunatus recounts these events as follows
If Divinity fosters it, misfortune often leads to salvation. Thus her innocent brother was killed so that she might come to live in religion.(20) She left the king and went straight to holy Médard at Noyon. She earnestly begged that she might change her garments and be consecrated to God.(21) But mindful of the words of the Apostle: “Art thou bound unto a wife? Seek not to be loosed,”(22) he hesitated to garb the Queen in the robe of a monacha. For even then, nobles were harassing the holy man and attempting to drag him brutally through the basilica from the altar to keep him from veiling the king’s spouse lest the priest imagine he could take away the king’s official queen as though she were only a prostitute.(23) That holiest of women knew this and, sizing up the situation, entered the sacristy put on a monastic garb and proceeded straight to the altar, saying to the blessed Médard: “If you shrink from consecrating me, and fear man more than God, Pastor, He will require His sheep’s soul from your hand.” He was thunderstruck by that argument and, laying his hand on her, he consecrated her as a deaconess.
It is readily apparent in the passage how significant it was for a queen to divest herself of her title, painted as a heroic act on both the part of the Melard and by Radegund herself. But with additional context it is clear that her flight was necessary for her survival. She remained immensely successful in the church, becoming an abbess who was by all accounts loved by many, including notable writers such as Fortunatus as well as Gregory of Tours. She is also venerated as a saint.
Christina of Markyate (1096-1155)- Flight in Post Norman England
Similar to Radegund, Christina was born of high status in post-Norman England. Her life is also recorded in a hagiography, but only one incomplete manuscript remains, and as such the details of her life remain somewhat unclear. She was also forced into marriage, as was expected of a woman of high birth and later forced into engagement with a man named Beorhtred, but already believed herself to be married to Christ (according to her hagiography). Her hagiography recounts her repeatedly hiding from her husband, avoiding being deflowered as would have been expected of her. Living as a single woman especially in her socioeconomic class would have been unfeasible, so she fled with the assistance of Eadwine, who hid her in men’s clothing. She then sought safety and shelter at St. Alban’s Abbey. She was released from her marriage contract two years after her flight, and her marriage was annulled in 1122. She became prioress, leading the nuns of St Albans and dying some 30 years later after the annulment of her marriage.
Marie D’Oigiens (1177-1213)- Beguines and the “Soft Block” Approach
As with the other two women I have mentioned, Marie was an upper class woman born into the expectations of marriage and child rearing. She was born in the 12th century in Belgium, found success later in life in the church, and is also venerated as a saint. Her hagiography was recorded by her confessor Jacques de Vitry. Unlike Radegund and Christina however, she was, and remained, married to her husband from the age of 14 until her death. While she did not flee to the church, she was able to convince her husband to maintain a vow of chastity with her. With him, she was able to heal lepers and successfully make her presence and power known within the church. Her hagiography records her conversion of her husband as follows (recorded in a Middle English translation from the original French)
When she had lived for a time in matrimony with John, her spouse, Our Lord beheld the humility of His maiden and graciously heard her prayers; for John was inspired to commend Mary, whom he had lived with first as his wife, to a life of chastity. The Lord made the chaste man tutor of His maiden, so that she should have solace from her guardian, and left her a faithful provider, so that she might more freely serve Our Lord. Out of natural goodness John did not oppose the holy intentions of his wife, as is the custom among other men, but patiently supported her in her good works and had compassion on her. He was inspired by Our Lord not only to promise to live an angelic life of continence and chastity, but to give all that he had to poor men for the love of Christ and to follow his companion in her holy purpose and religious life. Indeed, the further he was separated from her by carnal affection, the closer he was bound to her by the love of spiritual wedlock. Because of this, Our Lord later appeared in a vision to His maiden and promised that He would reward her in heaven for undertaking this form of matrimony with her spouse, who for the love of chastity had abstained from indulging in fleshly lusts on earth.
I believe she is still an important figure to bring up in this discussion, as she was one of the pioneering figures in a unique religious lay order called Beguines. This was a movement that began in the 13th century in the low countries that allowed people (primarily women) to observe a semi-monastic life in communities of other religiously affiliated individuals. This allowed many women to escape the social pressures of marriage, while avoiding the harsher rules involved in full monastic life. Vows of chastity were often made informally, but most importantly there was an avenue for women to gain prominence and live among other women in a way that did not require their full permanent commitment to the church. I will not go entirely into the details of the order, as I think it is largely tangential to the larger point that I would like to make, but I maintain that Marie remains a potent example of some of the power that women had to separate themselves partially from their husbands, without fully fleeing into monastic life (I have heard this affectionately being called “the soft block” by a professor, a title which I believe is fairly apt).
edit- small typo corrected (Marie was born in 1177, not 117)