I did a search, and although there are questions about seppuku, I didn't see anyone ask how it started.
The first recorded instance was Minamoto no Yorimasa during the Gempei War; he was disgraced after losing a battle in 1180 and suicide, by striking the most painful place on the body, would restore honor. Over time the act slowly became ritualized until it hit the full elaborateness of the Edo Period.
Women also participated in suicide, although they did not usually cut their stomachs, they cut their throats instead.
Seppuku--especially during the Warring States Period--actually seems to have been discouraged because Daimyo did not want to lose powerful or skilled samurai.
Sources: The Samurai, by Stephen Turnbull. A history of Japan to 1333, by George Sansom