Al-Bukhaari said in his Saheeh: Qutaadah said: “Allaah created these stars for three purposes: to adorn the heavens, to stone the devils and as signs by which to navigate. Whoever seeks anything else in them is mistaken and does not benefit from them, and he is wasting his time and effort in seeking something of which he has no knowledge.” (Saheeh al-Bukhaari, Baab fi’l-Nujoom, 2/240)
The study of the stars is divided into two kinds:
1- Study of the influence of the stars (astrology)
2- Study of the positions and movements of the stars (astronomy)
Study of the influence of the stars (astrology) is divided into three categories:
1 – The belief that these stars have a real influence in the sense that they create events and evil. This is major shirk (shirk akbar), because whoever claims that there is another creator alongside Allaah is a mushrik in the sense of major shirk, for he is regarding a created thing that is subjugated as a creator which subjugates.
2 – Making this a reason to claim to have knowledge of the unseen, so from the movements and changes in the stars he deduces that such and such will happen because such and such has happened to such and such a star. For example, he may say that one person’s life will be miserable because he was born under this star, and that another person’s life will be happy because he was born under that star. This person is taking knowledge of the stars as a means to claim that he has knowledge of the unseen, and claiming to have knowledge of the unseen is kufr (disbelief) which puts one beyond the pale of Islam, because Allaah says (interpretation of the meaning):
“Say: None in the heavens and the earth knows the Ghayb (Unseen) except Allaah”[al-Naml 29:65]
The grammatical structure used in the original Arabic – starting with the negation laa (translated here as “none”) followed by the word illa (“except”) – is one of the most emphatic ways of expressing exclusivity. So if a person claims to know the unseen, he is effectively disbelieving what the Qur’aan says.
3 – If he believes that the stars are the cause of good or bad things happening, this is minor shirk (shirk asghar), i.e., when something happens he attributes it to the stars (and only attributes it to the stars after it has happened). The basic principle is that whoever believes that one thing is the cause of another when Allaah has not made it so, is overstepping the mark and not acknowledging Allaah as He should be acknowledged, because the One Who makes things happen is Allaah alone. For example, if a person seeks healing from a piece of string (tied around his wrist), and says, “I believe that healing is in the hand of Allaah and this string is simply the means,” we would say to him, “You have saved yourself from major shirk but you have fallen into lesser shirk, because Allaah has not made string a clear means of healing. By doing this you have transgressed against His position of Controller and Sustainer, by making something a means to something else when Allaah has not made it so.” The same applies to one who regards the stars as the cause of rainfall when this is not the case. The evidence for that is the hadeeth narrated by al-Bukhaari (801) and Muslim (104) from Zayd ibn Khaalid al-Juhani who said: “The Messenger of Allaah SAWs (peace and blessings of Allaah be upon him) led us in praying Fajr at al-Hudaybiyah, following rainfall during the night. When he had finished praying, he turned to the people and said, ‘Do you know what your Lord has said?’ They said, ‘Allaah and His Messenger know best.’ He said, ‘This morning one of My slaves became a believer in Me and one became a disbeliever. As for the one who said, “We have been given rain by virtue of Allaah and His mercy,” he is a believer in Me and a disbeliever in the stars. But as for the one who said, “We have been given rain by such and such a star,” he is a disbeliever in Me and a believer in the stars.’” So the one who attributes rain to the stars is saying that the stars caused the rain.
Study of the positions and movements of the stars (astronomy) is divided into two categories:
1 – If their movements are used to define things that serve a religious purpose, this is something that is necessary. If that helps in the case of religious obligations, then learning it is obligatory, such as using the stars to determine the direction of the qiblah (direction of Makkah).
2 – If their movements are used to define things that serve a worldly purpose, there is nothing wrong with that. This is of two types:
(a) Using the stars to work out directions, such as knowing that the pole lies to the north, and that the Pole Star, which is close to it, revolves around the North Pole. This is permissible. Allaah says (interpretation of the meaning):
“And landmarks (signposts, during the day) and by the stars (during the night), they (mankind) guide themselves”
(b) Using the stars to work out the seasons, through learning the phases of the moon. Some of the salaf regarded this as makrooh while others permitted it. The correct view is that it is permissible and there is nothing makrooh in it, because there is no shirk involved in it, unless one learns it in order to attribute rainfall or cold weather to it, and says that this is what is causing that. That is a kind of shirk. But simply knowing the time of year from it, whether it is spring or autumn or winter, there is nothing wrong with that.
See al-Qawl al-Mufeed by Shaykh Muhammad ibn ‘Uthaymeen (may Allaah have mercy on him), 2/102.