This is the first time in decades a government has lost a vote on its own legislation in the lower house.
Opponents of the policy introduced the measure to amend the Migration Act to allow the temporary transfer of "transitory persons" from PNG or Nauru to Australia for medical assessment, a move backed by doctors.
Earlier on Tuesday, the ALP made some compromises on the bill, introducing amendments to give the Home Affairs Minister the power to overrule a medical transfer on specific security concerns and making changes to avoid a possible breach of the Australian Constitution.
The secretary will have to refer the case to the Immigration Minister, who will have 72 hours to either approve or reject a transfer.
The Australian government announced on Wednesday the reopening of a controversial detention centre on Christmas Island a day after it lost a vote on a bill to help evacuate critically ill refugees from offshore processing centres to get treatment in the country.
"Yesterday was a win for compassion and decency over the politics of fearmongering and hysteria and cruelty that we have seen under this government", he added.
Immigration Minister David Coleman said on Sunday the change would bring a return of the days when thousands of asylum-seekers traveled to Indonesia and then paid smugglers to take them on to Australia by boat. "Whatever mandate governments may claim to be tough on border protection, there has never been a mandate to treat people like this".
"My job now is to do everything within my power, and the power of the government, to ensure that what the Parliament has done to weaken our borders does not result in boats coming to Australia", he said.
But the prime minister seized on border protection and Labor's backing for a parliamentary bill that would force the government to allow the medical evacuation of asylum seeker detainees on Manus Island and Nauru to mainland Australia on the advice of two doctors.
Mr Morrison lost his parliamentary majority a year ago and has been relying on cross-benchers to keep control of the Lower House of Representatives.
The opposition Labor Party and a group of independent MPs supported the legislation.
Doctors, lawyers, advocates and clergy say many refugees have been waiting years for medical intervention not available where they are detained.
If the minister rejects for it medical reasons, that decision can be reviewed by a medical panel, who can recommend it goes ahead.