Let not any one of you intend to observe prayer at the time of the rising of the sun or of the setting sun.
The Book of Prayer - Travellers
Author: Sahih Muslim | Hadith Reference: Sahih Muslim 828 a
Prohibition Explained
This prohibition concerns the specific times when the sun is rising and setting, for during these moments the disbelievers prostrate to the sun. The Muslim is thus commanded to distinguish their worship from that of the polytheists.
Scholarly Commentary
The wisdom behind this prohibition is to avoid any resemblance to the practice of sun-worshippers, who would direct their acts of devotion to the sun at these precise times. It is a matter of maintaining the purity of Islamic monotheism (Tawhid).
Furthermore, these are times when the gates of heaven are not open for the acceptance of voluntary prayers. The only exception to this ruling is the performance of the obligatory (Fard) prayer of 'Asr on that specific day, which may be prayed until the sun begins to set, provided its time was entered before the prohibition began.
Practical Application
One must not initiate any prayer, whether obligatory or supererogatory, when the sun's disc is visibly rising until it is fully risen and distinct from the horizon, and likewise when it is visibly setting until it has completely disappeared.