The dual Brownlow medallist fronted a packed media conference alongside his wife Danielle and coach Ross Lyon at Moorabbin on Wednesday morning.
He confirmed he will hang up the boots at the end of the season.
"I'm very happy and honoured to stretch my career out as long as I did," Harvey said. "It’s the right time for the club, the right time for myself."
In his 21 seasons, Harvey has won almost every individual accolade, but a premiership flag still eludes him. The Saints climbed to seventh with Sunday's win over Port Adelaide, and face a decisive battle with Collingwood on Saturday.
"This is the last opportunity to play finals footy – that's all I'm playing for," Harvey said.
“Our season is still alive and this is obviously my last chance at (the flag). You take me and Fraser [Gehrig] out and we’d nearly be the youngest list in the AFL, and I think that’s a great thing for the club, and we’ve got a great opportunity."
St Kilda players including Nick Riewoldt, Luke Ball, Steven Milne, Lenny Hayes and Gehrig attended the announcement, and Harvey said he hadn't enjoyed breaking the news to them.
“It is always hard to come off 21 years at a place," he said.
"You try to get the words right and they don’t quite come out the way you’d like. It was the hardest thing I’ve done. Last week has been a bit of a roller coaster because I knew I was going to retire but when you actually say it and when you agree to say it, it is a different thing."
Almost universally regarded as one of the game's greats, Harvey has played 376 senior games, ranking him in fourth spot on the all-time list behind Michael Tuck (426 games), Kevin Bartlett (403 games) and Simon Madden (378 games).
The oldest player in the AFL, he will turn 37 before the end of the home-and-away season.
Harvey began his career against Footscray in round 19, 1988. In his 10th season, in 1997, he won his first Brownlow medal, although he considered it a "hollow victory", having finished behind the suspended Chris Grant in the polling.
There were no ambiguities the following year, when he secured back to back Brownlow medals, plus his fourth and last club best and fairest.
Harvey won eight All-Australian selections, three EJ Whitten medals for best on ground in state-of-origin, the AFLPA MVP award in 1997, two pre-season flags and was skipper for two seasons (2001-02).
He played in St Kilda's beaten grand final side in 1997.
In 1997, Harvey said: "Once you get to 25 you realise there isn't long left – especially when you started at 16. Your body gets such a hammering each week. You wonder how long it can hold up."
He underwent a knee reconstruction in 2001, and in 2002 a shoulder injury again finished his season early, but he bounced back in 2003 to win his eighth All-Australian jumper.
He has played under seven coaches, beginning under Darrel Baldock and outlasting Ken Sheldon, Stan Alves, Tim Watson, Malcolm Blight and Grant Thomas.
"I'm happy to have stretched my career out as long as it did," Harvey said on Wednesday.
Saints midfielder Lenny Hayes recently paid tribute to the Saints champion.
"He's an absolute freak – 21 years in the game, it's just amazing," Hayes said.
"I still remember having the posters on my wall when was growing up of him, being a midfielder.
"To come and just watch how he trains, and be a teammate of his, was a great thrill for me.
"I think mentally he's the toughest bloke I've ever seen.
"Just to be able to get up for games, and just the way he pushes himself at training and during games.
"He's just a freak."