The two long periods are from the ‘Asr prayer until the sun begins to incline toward setting, and from the Fajr prayer—or from the rise of dawn—until the sun rises.
Repeating a Congregational Prayer
His statement, “and repeating a congregational prayer,” means that during these three times—and, with even greater reason, during the others—it is permissible for a person to repeat the congregational prayer. Thus, if he comes to a mosque where a congregation is praying and finds them in prayer after he has already prayed, he should pray with them, even if it is a prohibited time.
For example, a man prays ‘Asr in his own mosque, then goes to another mosque, perhaps to attend a lesson, and finds them praying. He should pray with them. The evidence is that the Prophet ﷺ once prayed Fajr at Mina. When he finished, he saw two men who had withdrawn aside and had not prayed with the people. He summoned them, and they were brought before him trembling with fear. He said, “What prevented you from praying with us?” They replied, “O Messenger of Allah, we had already prayed at our lodging.” He said to them, “When you have prayed at your lodgings and then come to a mosque where there is a congregation, pray with them, for it will count for you as a voluntary prayer.” (1)
That is, the second prayer is voluntary for them. This explicitly establishes the permissibility of repeating the congregational prayer during a prohibited time. This hadith also indicates that one who remains seated while the people are praying should be reproved, because this is an aberration and a departure from the congregation.
Indeed, the Prophet ﷺ said, “When the prayer has been commenced, there is no prayer except the prescribed prayer.”