1) THE SUN STOOD STILL FOR YEHOSHUA
QUESTION: The Gemara quotes the verse that describes the sun when it stood still for Yehoshua, "va'Yidom ha'Shemesh" -- "And the sun remained still" (Yehoshua 10:13). The word "va'Yidom" can also be translated as "remained silent." RASHI explains that as long as the sun continues on its path, it is constantly expressing Shirah, praise, to Hash-m. When the sun stopped moving for Yehoshua, it stopped expressing Shirah, and Yehoshua said Shirah to Hash-m in its place.
What does Rashi mean when he says that Yehoshua said Shirah instead of the sun?
ANSWER: The MESHECH CHOCHMAH (beginning of Shemos) explains at length many important aspects of the prophecy of Moshe Rabeinu. Among his discussion, he offers insight into the words of the Gemara here.
Why is it that the only people who stopped the sun were Moshe and Yehoshua?
(Although the Gemara says that Nakdimon ben Guryon also stopped the sun, the Gemara in Ta'anis (20a) says that "the sun was 'Nikderah'" (or "Nakdah," or "Nikdemah"; see Girsa of the EIN YAKOV and RAV YAKOV EMDEN). This may mean that the sun "punctured" the clouds, which means that the sun was visible in the sky after it had seemed that night had fallen due to the cloud cover, as is evident from the story there. The Chachamim grouped that miracle together with the miracle of Moshe and Yehoshua in order to teach that we must be just as grateful for the miracle that happened for Nakdimon as we are for the miracles that happened for Moshe and Yehoshua. Although the miracle was lesser, the generation was much less deserving of a miracle.)
The Gemara in Chulin (7a) relates how Rebbi Pinchas ben Yair arrived at a river and asked the river to stop flowing and to allow him to pass. The river responded, "I am greater than you, because even if you are on your way to do a Mitzvah, you might end up not doing it. I, however, am certainly going to [continue flowing and] do the will of my Master, the Creator." The point of that dialogue is that man has no right to intervene in the natural processes of the world, since man reflects the will of his Creator to a lesser extent than do the other creations of the natural world. This is because man is subject to free will, while nature has no choice about its obedience to the Divine will and thus cannot fail in carrying out His will.
The Meshech Chochmah points out, however, that there are exceptions to this rule. Some people lose their free will. There are times when Hash-m takes away a person's free will in order to prevent his evil plans to harm others from being realized, or as a punishment for his previous sins. There are also times when Hash-m takes away a person's free will because the person has reached such a high level of service of Hash-m that he is able to perceive the will of Hash-m with the same clarity as the Mal'achim perceive, and thus he no longer can even conceive of transgressing Hash-m's will. (See TOSFOS to Bava Basra 17a, DH Sheloshah Lo.)
One such person whose free will was removed because of the great level that he reached in Avodas Hash-m was Moshe Rabeinu. The proof of this is the fact that Hash-m told the Jewish people during Moshe Rabeinu's lifetime that no other prophet can ever revoke what Moshe Rabeinu says, and that everything he says must be accepted. If Moshe Rabeinu had the free will to sin and to misrepresent the will of Hash-m, then how could Hash-m tell us that we must follow whatever he says? Obviously, by that time, Moshe Rabeinu no longer had any free will to sin.
This is why Moshe Rabeinu was able to stop the sun. Although a person who has free will is on a lower level of Avodas Hash-m than the elements of the natural world, a person who began with free will but perfected himself so much that he reached a level where he no longer has free will is on a higher level than even the elements of the natural world. This is why Moshe Rabeinu was able to stop the sun.
The Meshech Chochmah proves that Yehoshua also reached a certain degree of that level, as we find that Yehoshua wrote the last eight verses of the Torah (see Bava Basra 14b). This is why he, too, was able to stop the sun.
We can now better understand the Shirah that Yehoshua expressed in place of the sun. The RAMBAM (Hilchos Yesodei ha'Torah 3:9) writes that all of the stars and heavenly bodies "have a soul, knowledge, and understanding," and "they live and recognize Hash-m," and "each one according to its level praises and lauds Hash-m as do the Mal'achim." He adds that the knowledge of these heavenly bodies is less than that of the Mal'achim but greater than that of man.
It is difficult to understand these words in a literal sense. Perhaps the Rambam means that these heavenly bodies that unceasingly carry out their missions to such perfection, with no shortcomings or imperfections, reflect to a greater extent the greatness and infinite wisdom of Hash-m than does man, with his obvious failings and imperfection.
The praises that the heavenly bodies express to Hash-m are the very way in which they carry out their duty in a manner that reflects the infinite wisdom of Hash-m. (See Insights to Yoma 20:3.)
Moshe and Yehoshua, who reached a level of perfection even higher than that of the heavenly bodies, reflected the honor of Hash-m and His infinite wisdom to an even greater degree than the heavenly bodies do. This became evident to all when they demonstrated that even the heavenly bodies were subject to their will, and it is in this manner that they sang the praises of Hash-m to make up for the Shirah of the sun, which stopped its natural orbit, seemingly demonstrating an imperfection in nature.
2) THE SUN STOPPED TWICE
QUESTION: The Gemara relates that when Yehoshua fought against the kings of Kena'an, he stopped the sun two times, as the verse says, "The sun stood in the middle (top) of the sky," and it continues, "and it did not set" (Yehoshua 10:13), implying that it stopped again just before it was supposed to set.
The RADAK points out that this is also evident from the rest of the verse, "The sun stood still in Giv'on, and the moon in the valley of Ayalon." The SEDER OLAM teaches that Yehoshua performed this miracle on the third day of Tamuz. The moon at that time of the month is not far from the sun (it is about 36 degrees behind -- i.e., to the east of -- the sun). The valley of Ayalon, on the other hand, is to the west of Giv'on. If the sun stood still in Giv'on, then how could the moon be seen above the valley of Ayalon? It must be that the sun stopped twice -- the first time when it was overhead in Giv'on (at which time the moon could not have been seen because of the brightness of the sun). The sun stopped a second time just before it was supposed to set, such that the moon was visible to the east of the sun because of the darkened horizon, and that occurred when the Jewish people had continued their pursuit of the Kena'ani nations in the valley of Ayalon.
Why did Hash-m make the sun stop twice?
ANSWER: To understand why Hash-m made the sun stop twice, we must review what happened at that time. In Sefer Yehoshua (ch. 10), we are told that the Jewish people were encamped at Gilgal when the people of Giv'on made a peace treaty with them. The other nations of Kena'an made war with the Giv'onim to avenge their act of making peace with Yehoshua. Yehoshua led the Jews to Giv'on overnight to help support the Giv'onim. Hash-m told Yehoshua not to worry and that he will succeed in conquering the enemies. Indeed, the next morning Yehoshua came to Giv'on and fought the Kena'ani nations who suffered great losses. The nations began to flee from Giv'on (near the modern-day Jerusalem-suburb of Neve Yakov), passed Beit Choron (along the route of the old Jerusalem highway), and from there they continued pursuing them through the mountainous region of Harei Yehudah until the low hills of Ayalon, until Azekah and Makedah.
Based on this background information, the RADAK suggests that the first time the sun stopped (when Yehoshua was in Giv'on), Yehoshua had not yet conquered all of his enemies. Therefore, before the sun set, the sun stopped again to give time to Yehoshua to conquer his enemies, in order to fulfill Hash-m's promise that he would vanquish all of his enemies on that day.
Why, though, did the sun not wait and let Yehoshua conquer his enemies the first time that it stopped? Why did it start traveling its course again and then stop a second time? It seems that Yehoshua was not able to restrain the sun from moving beyond a certain amount of time (as the Amora'im in the Gemara here discuss). Therefore, the sun had to continue and then stop again in order to let Yehoshua complete the war.
RAV YITZCHAK LEVI zt'l (in IYUNIM AL SEFER YEHOSHUA) suggests a brilliant explanation for why Yehoshua did not keep the sun standing still the first time that it stopped, in order to complete the war. He points out that although it is advantageous to have the sun overhead while battling in the mountains, it is detrimental to fight a battle in the plains and valleys under the heat of the sun (the battles was fought on the third day of Tamuz, a time of year when the sun's rays beat down brutally). When Yehoshua fought in Giv'on, he did not know how long the war would take. He stopped the sun at midday, hoping to complete the war. However, when he saw the enemy flee towards the plains and valleys, he saw that if the sun remained directly overheard, it might be to his disadvantage. Therefore, he let the sun continue on its course, until the sun was just above the horizon -- which was the time when the enemy reached the plains and valleys. He then stopped the sun again (about six hours after he had stopped it at midday, the amount of time that it takes to get from Giv'on to the coastal plain) in order to complete the war without suffering the debilitating effects of the sun in its full force.

OTHER D.A.F. RESOURCES
ON THIS DAF