The Reason Why a Deceased Must Be Buried Immediately According to Islamic Law
Taking care of the deceased until their burial is a fard kifayah (collective obligation) for Muslims. Islam encourages that this process shouldn't be delayed without a valid reason, in line with the Prophet Muhammad's (PBUH) instruction to hasten the burial after the body has been washed, shrouded, and prayed over.
This recommendation holds wisdom, like respecting the rights of the deceased in the barzakh (the state between death and resurrection), easing the family's psychological burden, and preserving the dignity of the body from physical changes. The basis for this includes a hadith from Bukhari and Muslim that orders speeding up the funeral arrangements because if the person was righteous, it's a good thing, and if not, it's laying down a burden of evil.
According to fiqh (Islamic jurisprudence), burial can be temporarily postponed to wait for close relatives as long as the body remains in good condition and they're expected to arrive soon. Delay is also allowed in emergency situations like the need for an autopsy or waiting for the number of funeral prayer attendees to reach 40, as long as there's no worry about changes occurring to the body.
https://mozaik.inilah.com/dakw