The short answer here is ‘No, it did not literally happen’. This is a poetic description of an event found in the lost Book of Jasher. Please see another answer on BibleQ for information on that book: What is the Book of Jasher?
For a fuller answer here is an excerpt from a book by Harry Whittaker:
Harry Whittaker – Bible Studies – 3.03 Joshua’s long day (?)
‘Sun, stand thou still upon Gibeon,
And thou, Moon, in the valley of Aijalon,
And the sun stood still
And the moon stayed,
Until the nation had avenged themselves
of their enemies”.
ls it not written in the Book of Jasher?
What marvel took place on that astonishing day? Did the mighty machinery of the solar system have a spanner in its works specially so that the lsraelites could win a big victory? And if things really happened literally according to what the words say, why did not everything and everybody take off as if jet-propelled? For it has to be remembered that in the latitude of Palestine the earth’s surface and everything on it is revolving around the earth’s axis at about 800mph. Then was another mighty miracle performed to keep people and buildings and trees and oceans all in their place when the earth’s rotation stopped? – and yet another when everything started up again? Here, surely, is a miracle which is a hindrance to faith rather than an aid to it.
A little careful reading can save us from boggling at this ancient record. This is Holy Scripture and altogether dependable. If there are difficulties, then most likely they are difficulties manufactured by ourselves. There is no need to start concocting elaborate scientific theories regarding Joshua’s long day. lt is not science but geography which is the key to an understanding of what happened.
The Book of Jasher
But first notice those significant words: “Is it not written in the Book of Jasher?” Exactly nothing is known about this Book of Jasher, except that David’s long and lovely lament over the deaths of Saul and Jonathan was also to be found written there (2 Samuel 1:18). It also requires only a casual reading of the “Song of the Bow” to see that the Book of Jasher was (evidently) a collection of ancient songs and poetry. No one with any literary sense at all takes poetry in a strictly literal sense. For example:
“They were swifter than eagles’ “They were stronger than lions”‘
“The mountains and hills shall break forth into singing, And all the trees of the field shall clap their hands.”
The Bible has many such examples of this sort. Is it not likely, then, that this quote in Joshua 10 from the Book of Jasher is poetic language not to be taken in a strictly literal sense?
Another illusion to the Book of Jasher occurs in 1 Kings 8:12,13 LXX when the poetic character of the language is again evident.
A whole day?
The only way in which lengthening of a day could be measured would be by the amount of useful work the men of lsrael were able to put into it. And this is where a little careful geography throws a remarkable light on the incident.
If the reader traces out carefully on the map what Joshua and his men achieved during that period of twenty four hours, remarkable conclusions emerge: First, they “went up from Gilgal (to Gibeon) all the night”. This meant a march of about 18 miles through rugged mountain passes and included a climb of approximately 3,400 feet (many would consider that climb a full days work quite apart from the distance involved!) Early next morning the battle was joined, the enemy was defeated and then pursued down the valley of Beth-horon and southwards to Azekah and Makkedah which are a distance from Gibeon of at least 25 miles – as the crow flies – and the men of lsrael were not crows, nor did they have tanks or planes or even horses.All this in twenty-four hours! To require an army, even of lightly equipped men, to achieve so much was by ordinary standards to ask the impossible. Yet the men of lsrael did it. Here was the miracle. So much was accomplished on this amazing day that it could only be described in the poetic language of the Book of Jasher as a doubling of the day’s length. God responded to the need of his people for a speedy and complete victory by endowing them with the ability to pack into one day what no other army has ever achieved before or since.
(For more detail on this subject reference should be made to “Astronomy of the Bible,” lV.1 1908 by E. W. Maunder, who was a top-class astronomer and a very competent Bible student’)