All perfect praise be to Allah the Lord of the Worlds. May His peace and blessings be upon our Prophet Mohammad and upon all his family and companions.
If the dead is buried at times when prayer is forbidden-sunrise and sunset-then the following points should be taken into consideration:
1- If the dead is intentionally buried at these times, then this is reprehensible. The is based on the Hadith in which Uqba b. 'Amir said: "There were three times at which Allah's Messenger (Peace and blessings be upon him) forbade us to pray, or bury our dead: When the sun begins to rise till it is fully up, when the sun is at its height at midday till it passes over the meridian, and when the sun draws near to setting till it sets." {Transmitted by Muslim}.
2- If the dead is unintentionally buried at these times due to a certain condition, then this is neither sinful nor reprehensible, because, in principle, burying the dead is permissible and there is no evidence that it is reprehensible save the Hadith reported by Uqba b. Amir. Actually, the apparent meaning of this Hadith indicates that it is reprehensible to intentionally bury the dead at the above times, not that it is reprehensible absolutely.
An-Nawawi (May Allah have mercy on his soul) says: "Burying the dead, unintentionally, at the times when prayer is forbidden is not reprehensible according our Madhab (Shafie). This is stated by Al-Shafie in the book "Al-Umm," chapter on standing up when seeing a funeral. Our fellow scholars (Shafie) are also agreed on this.
Judge abu At-Taieb and Al-Motawali commented on the above Hadith where they said about intentionally burying the dead at the above times: "It is reprehensible, but if the dead is buried at these times unintentionally, then this is permissible and it isn`t the intended meaning of the Hadith." {Al-Majmou`, vol.5/pp.272}.
However, the Sunnah is to bury the dead at times other than those mentioned above. Al-Shirbini say: "It is better to bury the dead at times other than the night time and the times when prayer is forbidden provided that it isn`t feared that the body of the deceased would decompose. This is easier for the people to join the funeral procession and place the dead in the grave." {Moghni Al-Mohtaj, vol.2/pp.54}. And Allah The Almighty Knows Best.