There is a consensus that burying a dead body and covering it is a collective obligation (fard kifayah). If some Muslims bury the dead body, it would absolve the rest of them from this obligation. Allah, the Almighty, says: “Have We not caused the earth to hold within itself the living and the dead?” Qur’an 77.25-26
The majority of scholars are of the opinion that it is permissible to bury the dead anytime during the day or night. The Prophet, peace be upon him, buried at night a man, who used to remember Allah aloud during the night. Similarly ‘Ali buried Fatimah at night. Abu Bakr, ‘Uthman, ‘Aishah, and Ibn Mas’ud were buried during the night as well.
Ibn ‘Abbas reported: “The Prophet, peace be upon him, went into a grave one night and was given a lamp. Then he lifted the body from the side toward the qiblah, saying: “May Allah be merciful to you. You used to cry a lot and often recited the Qur’an.” After this the Prophet, peace be upon him, said four takbirs.”(Reported by Tirmizhi, who considers it a sound hadith) Tirmizhi said: “Most scholars consider the burial of the dead at night permissible, provided the rights of the deceased are not neglected.
The same applies to offering a funeral prayer for the deceased. The Prophet, peace be upon him, commanded his followers not to bury the deceased at night if it is feared that any of his rights might be neglected. Night time burial in such a case is disliked.
One day the Prophet, peace be upon him, delivered a sermon and mentioned one of his companions who had died and had been wrapped in a short shroud and buried during the night. The Prophet, peace be upon him, expressed his disapproval of burying someone at night unless one is compelled to do so. (Muslim) Jabir reported that the Prophet, peace be upon him, said: “Do not bury your dead during the night unless you are compelled to do so.” (Ibn Majah)