Acting Greens leader Adam Bandt took credit for Mr Danby's retirement, saying his party's progress in the inner-city seat had forced his hand.
"Michael has got out of the way because he's seen the Greens coming," Mr Bandt told reporters in Melbourne.
At the 2016 election, Labor's primary vote dipped to a record low of 27 per cent in Melbourne Ports, which will be renamed Macnamara.
Mr Danby won the three-cornered contest with a two-party preferred margin of 1.4 per cent over the Liberals, while the Greens snared 23 per cent of the vote.
His retirement comes amid ongoing factional wrangling in Victorian Labor, with Mr Shorten's allies fighting over a newly-created safe seat in Melbourne's west.
Mr Danby, a key backer of Mr Shorten, would have been pre-selected for the seat if he'd chosen to run again after heavyweight factions promised not to challenge sitting MPs.
Mr Shorten described Mr Danby, one of three Jewish MPs in federal parliament, as a true friend of Israel.
"Michael Danby has never cut his cloth to suit the fashion of the moment, he has always been his own man and at the next election, he leaves politics on his own terms," the Labor leader said.
Mr Shorten said he would continue to seek counsel from Mr Danby on foreign policy and human rights.
"I value Michael's friendship and his advice so highly because you always know, regardless of the circumstances, he's telling it to you straight," Mr Shorten said.
Mr Danby got into hot water with his party last year for using his taxpayer-funded electoral allowance to criticise an ABC journalist for what he claimed was anti-Israel bias.
He also controversially missed a week of parliament in 2016, providing a medical certificate saying he was unfit for parliamentary work but at the same time attended a conference in Israel.