See this English translation of a Sicha from the Lubavitcher Rebbe (Likutei Sichot Volume 15, pg 7-12).
A short synopsis from here:
Now, you, I and the Jewish sages of old all have known for a very long time that eclipses are natural events that can be predicted thousands of years in advance. Thus we can be quite certain that their statement does not mean that eclipses are results of ill behavior. Rather, an additional result of the celestial positioning that causes an eclipse is that certain people are especially prone to sin and punishment. This is not unlike the Talmudic teaching that people born under certain Zodiac signs are likely to follow certain paths. These factors do not take away of free will, but they do give us a propensity that we can and must overcome.
This is why the Talmud (Sukkah 29A) concludes "But when Israel fulfill the will of the Omnipresent, they need have no fear of all these [omens]" (translation from here)