The vote drew cheers from asylum-seeker activists in parliament's public gallery but the upper house must approve the bill before it becomes law, so the defeat, though damaging for the government, does not trigger an immediate election.
An Afghan asylum seeker allegedly grabbed two nurses' bottoms after being rushed from Nauru to Australia for medical treatment.
Morrison last week ruled out calling a snap election if his government was defeated over the "stupid" bill.
Labor has handed the Coalition a campaign gift, and the Liberal Party will be quickly dusting off their tried and tested campaign material on boat arrivals and erecting billboards in marginal seats across the country.
The Australian government has suffered an historic defeat, losing a vote on the floor of the House of Representatives for the first time since 1941.
About 1,200 refugees are estimated to be in exile in Nauru and Papua New Guinea's Manus, where they've been indefinitely detained for nearly six years.
The Senate passed similar amendments on medical evacuations despite ruling party objections on the last day Parliament sat previous year.
Prime Minister Scott Morrison has announced the detention centre would be reopened as part of "a range of strengthening" of Operation Sovereign Borders, arguing the new legislation will undermine border protection policies and could restart the people smuggling trade.
"My job now is to ensure that the boats don't come", Morrison told reporters.
Late past year, public pressure over severe health issues facing children living on the islands prompted officials to allow all of them to be relocated to Australia.
Phil Glendenning, President of the Refugee Council of Australia said, "We thank and congratulate all the Members of Parliament and Senators who came together and voted with their conscience on this long overdue legislation".
Labor leader Bill Shorten says his party is tough but fair on border control after it backed the bill.
Even still, Mr Shorten believes the "incompetent and divided" Morrison government should call an election as soon as possible.
The government says the Christmas Island re-start will cost about $1.4 billion over four years.
"Many people are happy now because they will finally receive medical treatment".
Major changes to Australia's health system would be led by a new, independent expert commission under a federal Labor government, making reforms harder to unpick.
"I know how much the people who are sick on Manus Island and Nauru are suffering and Parliament is saying enough is enough,"Dr Phelps said after the vote".