"The allegations against me today made public by the ABC are false," Mr Foley said.
"However, I can't fight to clear my name and fight an election at the same time. It's just not possible to do both.
"Therefore I'm resigning the leadership of the Labor Party effective today. This will enable a new leader to give his or her full attention to the task of defeating the Liberal-National government."
Mr Foley said he would remain on the backbench as the MP for Auburn before leaving before answering any questions from the media.
Maroubra MP Michael Daley is favourite to be elected Labor leader, with Penny Sharpe his deputy.
However, late on Thursday Kogarah MP Chris Minns was said to be "sounding out his colleagues" and is expected to also nominate for the leadership. MPs will vote at a special caucus meeting on Saturday.
Ms Raper, who has declined to comment since Corrections Minister David Elliott first raised the allegations against Mr Foley under parliamentary privilege, said she decided to break her silence after recent conversations with the former Opposition Leader.
The statement had been released after Ms Raper said Mr Foley reneged on a promise he made during a phone conversation with her on Sunday to resign as Opposition Leader by Wednesday.
During that conversation, Ms Raper alleges Mr Foley told her: "I’m not a groper, I’m just a drunk idiot."
Her statement said: "This is a position I never wanted to be in and a statement I never intended to make.
"But I think the time has come for my voice to be heard."
Ms Raper said the "escalation of the public debate, including in state and federal parliament despite my expressed wish to neither comment nor complain, and the likelihood of ongoing media and political interest" prompted her to speak
Her statement said: "This is what happened on that night.
"The party moved from Parliament House to Martin Place Bar after a number of hours. Later in the evening, Luke Foley approached a group of people, including me, to say goodnight. He stood next to me.
"He put his hand through a gap in the back of my dress and inside my underpants. He rested his hand on my buttocks.
"I completely froze."
She said Sean Nicholls, who was then the state political editor at The Sydney Morning Herald and is now an ABC journalist, witnessed the incident.
Ms Raper said Mr Foley then left the bar and she discussed what had happened with Mr Nicholls.
"As shaken as I was, I decided not to take any action and asked Sean to keep the events in the strictest confidence. He has honoured that," her statement says.
She said there were several reasons for not wanting to make a complaint.
"It is clear to me that a woman who is the subject of such behaviour is often the person who suffers once a complaint is made," Ms Raper said.
"I cherished my position as a state political reporter and feared that would be lost.
"I also feared the negative impact the publicity could have on me personally and on my young family.
"This impact is now being felt profoundly."
Ms Raper said she had a 19-minute telephone conversation with Mr Foley on Sunday during which he said to her he was "full of remorse for his behaviour" at the Christmas function.
"He told me that he had wanted to talk to me about that night on many occasions over the past two years because, while he was drunk and couldn’t remember all the details of the night, he knew he did something to offend me," she said.
"He apologised again and told me, 'I’m not a philanderer, I’m not a groper, I’m just a drunk idiot.'
She said he promised to resign on either Monday or Wednesday, but not Tuesday because he "didn't want to be accused of burying the story" on Melbourne Cup Day.
But Mr Foley then called her on Tuesday, she said. During the call, he repeated his apology but said he would not be resigning as Opposition Leader, based on legal advice, she said.
Mr Foley’s caucus colleagues had maintained that they would not move on him as long as he continued to deny the allegation and Ms Raper did not make a statement.
Blue Mountains Labor MP Trish Doyle was the first Labor MP to publicly call on Mr Foley to resign on Thursday, and threatened to call a leadership spill if he refused to do so.
"In my view Mr Foley's position is untenable and he must resign today," Ms Doyle said in a statement.
"I'm concerned that this issue has drawn out and caused such distress and anguish for the journalist at the centre of it."
The public broadcaster launched an investigation after Liberal senator Eric Abetz asked ABC acting managing director David Anderson about the allegations in a Senate estimates hearing.