Our Gemara on Amud Aleph states:
When the sun is eclipsed it is a bad omen for the entire world. The Gemara tells a parable. To what is this matter comparable? It is comparable to a king of flesh and blood who prepared a feast for his servants and placed a lantern [panas] before them to illuminate the hall. He became angry at them and said to his servant: Take the lantern from before them and seat them in darkness.
How can we make sense of this when we know that an eclipse is an astronomical event which can be predicted with great accuracy, and not in response to anything other than predetermined orbital mechanics. It is also relevant that the Greek philosopher and mathematician, Thales was able to calculate and predict a solar eclipse in 585 BCE, and the rabbis may very well have had this knowledge too. We do know that they were aware of Haley’s Comet, see Horiyos 10a.
Fortunately, we have a great resource in Rishonim who set precedents in the manner in which they managed contradictions between Torah and their science of the day. It so important to point out, that unlike post haskalah acharonim, the Rishonim were simply not defensive about contradictions between Torah and science. They never ran away from them nor asked us to believe that science was inaccurate. They simply took it for granted that the two sources of truth were in apparent contradiction; this was no different than when a Gemara or Tosafos found an Apparent contradiction between two teachings. The resolution lay in resolving the contradiction via more nuanced reinterpretation. It was extremely rare that any source was discredited.
Rambam in his commentary on Avos (5:6) Grapples with the idea of miracles in general. Miracles represented a problem because nature was instituted by the will of God which represents absolute unchanging wisdom, so how could God “change his mind”, and make something different happen later on? The resolution to this is read within the Mishna itself, that in fact all miracles are “pre-programmed“ and integrated into nature itself from the very beginning. That is, for example, the pit that swallowed up Korach and his henchmen was already programmed into nature from the beginning of time to occur.
Now, the Rambam must also have believed that the pit that swallowed them up was still in response to their sinful actions. Therefore, we see that a predetermined event can still be in response to current problems, as the omniscient creator was able to foresee. If so, we can offer the same answer in regard to the bad omen of the eclipse.
Another approach comes from Ramban on Chumash in regard to the rainbow. The verse (Bereishis 9:13) implies that God created the rainbow as a sign to remind Him of his covenant to no longer bring a deluge onto the earth. The problem with this is that the Ramban was well aware that the light spectrum was tied into complex physics and it was not possible for the universe to function without it in pre-flood days. God simply could not all of the sudden invent the Rainbow. If God did so,the Universe prior to the Rainbow had different physics and might have well been a different creation.
THIS IS THE SIGN OF THE COVENANT WHICH I MAKE. It would appear from this sign that the rainbow in the cloud was not part of creation and that now G-d created a new thing by making a rainbow in the heavens on a cloudy day…We must perforce believe the words of the Greek [philosophers who maintain] that the rainbow is a natural result of the heat of the sun falling upon damp air for even in a vessel containing water which stands in the sun there is the appearance of the rainbow. When contemplating the language of Scripture we will understand that it is so, for He said, I have set My bow in the cloud, [the use of the past tense indicating that He had already set it so from the beginning and it is not a new creation]. He did not say, “I set in the cloud,” even as He said, This is the sign of the covenant which I make. Moreover, the word kashti (My bow) — [in the possessive form] — indicates that He possessed the bow previously. Therefore, we shall explain the verse thus: “The rainbow which I have set in the clouds from the day of creation will be from this day on a sign of covenant between Me and you; whenever I will see it I will remember that there is a covenant of peace between Me and you.”
And should you want to know how the rainbow can be a sign, the answer is that it has the same meaning as the verse, This stone-heap be witness, and this pillar be witness; Genesis 31:52. likewise, For these seven ewe-lambs shalt thou take of my hand, that it may be a witness unto m., 21:30. Every visible object that is set before two parties to remind them of a matter that they have vowed between them is called a “sign,” and every agreement is called a “covenant.” Similarly, in the case of circumcision, He said, And it shall be a token of a covenant between Me and you, 17:11. because of the agreement that all seed of Abraham be circumcised to serve Him…Moreover, when the above-mentioned rainbow is seen in its inverted form, [namely, with the feet of the bow turned downward], it is a reminder of peace, as we have written. Thus, whether the bow was a newly established phenomenon or one that always existed in nature, the significance thereof as a sign is the same.
What we see from Ramban is a different twist. The sign can be in place from eternity, however it takes new significance once the covenant is declared. So too, whenever we do see an eclipse, it’s a reminder of our sins and metaphorically we can imagine an angry ruler withholding light. It’s just like Yom Kippur which comes up every year at the same time, but still inspires us to think about our sins.
The bottom line is, Science and Torah are in a dialogue. As man’s consciousness evolves and he learns about more things in the world, as God Himself wishes by endowing man with intellect and curiosity, the eternal truths of the Torah become understood differently and we relate differently to the very same words. This is a pathway blazed by authorities no less than the saintly Ramban and Rambam.