The answer is yes.
God has the power to do anything. He can restore the prostitute to a new virgin, he can take away the guilt of premarital sex, he can take away the grief and pain of rape. All we have to do is wholeheartedly ask for it, and believe he will answer us. 1 John 1:9 says, "If we confess our sins, he is faithful and just to forgive us our sins and to cleanse us from all unrighteousness."
When two people have sex the bible says that "the two shall become one flesh.' So they are no longer two but one flesh." (Mark 10:8) Therefore, any person you have previously slept with has a piece of your heart, flesh, and spirit. This can cause extreme pain, guilt, and insecurity, not only now but also in a marriage later on. The only way to truly be healed and set free is to admit your sins to God specifically, admit the hurt, confess everything, and ask for forgiveness. Then trust God to keep his promise and restore your spirit.
Here is a prayer my friend recently showed me. It is called the "Soul Ties Prayer" because it is meant to break the soul ties between to sexual partners who were not married. I am sharing it with you below:
Lord I confess I have practiced (fornication, adultery or homosexuality). I choose to repent for my sinful
practices and ask that you break this sin with the power of your cross and cover my sin with Your Blood.
I confess all my ungodly spirit, soul, and body ties as sin. I thank you for forgiving me and cleansing me!
In Jesus name, I ask you to loose me from all soulish ties in past sex partners and ungodly relationships.
Lord, I pray that You take the Sword of Truth and separate my spirit from _________(name) so that I can be free
to be wholly given and presented to my mate. Return my spirit to me, and ________’s(name) spirit to them.
In Jesus name, please uproot all the tentacles of sexual bondage, of emotional longings and dependencies,
and enslaving thoughts. I bind, renounce, and resist any evil spirits that have reinforced those soul ties or
may have been transferred between me through evil associations.
I direct my personal spirit in the name of Jesus to forget this union and remember it no longer.
Lord, I confess that I have feelings of guilt and shame, I take my feelings of guilt and shame arising from
this relationship to your cross. In Jesus name I break these feelings off me.
Lord, I pray blessings over __________. (Pray blessings as the Holy Spirit directs you)
Please cleanse my soul and help me to forget all illicit unions so that I am free to give my soul to you and
to my mate. Father, I receive your forgiveness. I believe I am totally forgiven.
Pray this over each person you have messed around with/had sex with. It is really helpful and freeing! Trust the holy spirit to do his work with this.