He quit despite surviving a vote on an opposition motion to remove him.
Mr Slipper is accused of sexual harassment by a former staff member, and of sending lurid text messages, now revealed in court documents.
His resignation could harm Ms Gillard's slender majority, which relies on votes from independent MPs.
Mr Slipper defected from opposition leader Tony Abbot's Liberal Party last year, becoming an independent.
He was swiftly promoted to the non-voting role of Speaker, freeing up his predecessor - Labour member Harry Jenkins - and effectively giving Ms Gillard a two-seat majority in the House.
His resignation now means Ms Gillard is dependent on Mr Slipper as an independent to help pass legislation.
Mr Slipper appeared to fight back tears in an emotional return to the House to announce his decision to resign, saying it was made with "great sadness" and regret.
His resignation followed a heated debate between Ms Gillard and Mr Abbot on Tuesday, with Mr Abbot accusing Mr Slipper of not being a "fit and proper" person for position of Speaker.
On Monday, court documents filed as part of a sexual harassment lawsuit being brought against him gave details of lurid text messages he is alleged to have sent his accuser, who is openly gay.
Mr Slipper, who is married, earlier apologised for the content of the text messages. He also denies the charges of sexual harassment.
He had been absent from parliament since April when he voluntarily stepped aside while the case against him was investigated.

Police issued an alert after a complaint was made that two men were acting suspiciously near secondary schools in Carrickfergus.
Mysterious pictures online of a clown and a balaclava-wearing sidekick have caused a stir in the town.
The police appeal caused a backlash on social media from some people who felt they were cracking down on fun.
Police said they started an investigation after receiving reports from parents that their children were frightened of the clown.
A police officer wrote on the PSNI Newtownabbey and Carrickfergus Facebook page: "Fun is fun but frightening school pupils is another."
The mystery man, who calls himself the Carrick "Killer Clown", contacted the police following the appeal to apologise for any distress.
"He assures me that this was a prank and it was not his intention in any way to frighten the school pupils or cause distress," the officer wrote.
"He fully appreciates the sensitivities of schools and photographs etc in the area of any school."
Speaking to BBC Radio Ulster's Evening Extra programme the clown said he had been sent messages from people concerned about their children.
"That wasn't the aim. The aim was for a bit of fun. I'm a parent myself," he said.
"We thought this was a wonderful idea - to go and get this picture and it was only when somebody voiced their concern I was like 'this is actually wrong, this isn't even funny'.
"I was talking to the police officer in charge again. I offered to go to the schools and apologize to the heads, obviously in my plain clothes, and he spoke to the heads on my behalf and they were happy with the apology through the police. So hopefully the parents will get that relayed to them."
Earlier, a post on Carrick Killer Clowns' Facebook page read: "Due to the mixed response to the school pictures they have been removed - this whole thing is supposed to be a laugh and some parents find this distasteful and unfunny."
However, they later posted a picture of themselves standing outside the police station in Carrickfergus.
Australia's parliament Speaker Peter Slipper has resigned amid a continuing sex scandal, dealing a blow to Prime Minister Julia Gillard's government.
[NEXT_CONCEPT]
A clown has turned himself in to the police after alarm was raised among frightened parents in County Antrim.