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.
Australia's parliament Speaker Peter Slipper has resigned amid a continuing sex scandal, dealing a blow to Prime Minister Julia Gillard's government.