Blanton911
I am really sorry to read about such a terrible thing happening to you. As a father of two daughters, I could only imagine the anger that I would feel if someone took advantage of any of my girls in that way. I can sense your pain that someone who was supposed to be a friend would do such a thing. I hope that you have reported this person and that he is in a jail cell with time to think about what he did.
I have a difficult time believing that God ALLOWED (as in giving His divine permission for it to happen when He could have stopped it) this to happen. I could not begin to understand why God intervened the second time but not the first. However, I cannot see Him having allowed it to happen simply because He knew that you could handle it. This is contrary to His nature.
In the the Pentetuech (the first five books of the Bible written by Moses), rape was condemned and punishable by DEATH. This is enough to prove that God abhors such an action.
This is not the time for me to play "blame the victim" and tell you everything that you may have done wrong. However, regardless of whatever led to your situation and regardless of why God did not intervene the first time, try not to build a theology around this that is not supported by Scripture. Instead, move on to allowing God to heal you emotionally and perhaps even physically from this tragedy. Do not allow the devil to make you feel dirty either. There is no excuse for someone overpowering you and doing what he did.
But in the future claim God's promises of protection and listen for His discerning voice when you are around people of the opposite sex. It's never wise to be alone with a man anyway no matter how good friends you two may be. Move on with your life from here but in moving on, be careful not to assign motives to God that are not commensurate with His nature.