Good morning! One of our writers answered your question:
The Bible presents this as a miracle. I like Richard L. Purtill’s definition of a miracle: “A miracle is an event (1) brought about by the power of God that is (2) a temporary (3) exception (4) to the ordinary course of nature (5) for the purpose of showing that God has acted in history.” How God brought this about, we do not know. The Bible does not tell us this. It merely presents this as a unique time in which God powerfully intervened and disrupted the ordinary course of nature.
Something that is often lost on us as readers today is the significance of God choosing to use these particular elements in a miraculous way to fight for His people and bring judgment on the Amorites. It is noteworthy that the Amorites worshiped gods who they thought controlled the elements God uses in Joshua 10 to destroy them. God’s miraculous use of these elements showed that He, and not the Amorite gods, was Lord over these things and the only true God worthy of worship.