Prime Minister Najib Razak said a coroner had approved the release of Kim Jong-nam's body.
Mr Kim was murdered at Kuala Lumpur airport with a lethal nerve agent last month.
The assassination led to a diplomatic dispute between Malaysia and North Korea.
Prime Minister Najib said nine Malaysians who had been barred from leaving North Korea had now been given permission to return to Malaysia, and North Koreans would be allowed to leave Malaysia .
Malaysia has not directly blamed North Korea for the killing, but there is widespread suspicion Pyongyang was responsible.
Mr Najib said: "I had a deep personal concern about this matter, and we worked intensively behind the scenes to achieve this successful outcome.
"Many challenges were overcome to ensure the return of our fellow Malaysians."
Malaysian investigators had demanded North Korea hand over suspects, three of whom were thought to be hiding in the country's embassy in Malaysia. It is unclear if they are among the North Koreans now being allowed to leave Malaysia.
In turn, North Korea demanded Malaysia turn over Kim Jong-nam's body and strongly denied any role in the killing.
Mr Najib said: "The government believes strongly in the principles of justice and sovereignty. Our police investigation into this serious crime on Malaysian soil will continue.
"I have instructed for all possible measures to be taken to bring those responsible for this murder to justice."
Two women - one Vietnamese woman and one Indonesian - have been charged with killing Mr Kim. Both reportedly believed they were participating in a television prank.
Interpol has issued a "red notice" for four North Koreans wanted in connection with the assassination.
Malaysia said the four men were at the airport on the day Mr Kim was killed and had since left the country. They are thought to be in North Korea.
A red notice is the nearest equivalent to an international arrest warrant. The move is unlikely to result in arrests as North Korea is not a member of Interpol.
The four named in the Interpol red notice are Ri Ji Hyon, 33, Hong Song Hac, 34, O Jong Gil, 55, and Ri Jae Nam, 57.
Kim Jong-nam, who was the estranged, elder half-brother of Kim Jong-un, had been passed over for the North Korean succession and was living in the Chinese territory of Macau at the time of his death.
It is not clear where Mr Kim's wife and children are, although his son appeared in a video earlier in March and said the family were together.
Kim Jong-nam sought help at the airport shortly after his face was smeared with the deadly VX nerve agent