The Hadith has strongly prohibited one from getting involved in fortune telling or trying to predict the future through stars. To believe that the stars coming in a certain formation leads to a certain event taking place, or trying to predict the future through looking at stars (e.g. referring to zodiac signs, horoscopes, etc.) is haraam and an act of disbelief.
There are severe warnings in the Hadith for those who get involved in these major sins. Rasulullah (sallallahu ‘alaihi wasallam) said, “The one who has relations with his wife while she is in the state of haidh, or has relations with her from the anal passage, or he goes to a fortune teller, then he has certainly rejected that which has been revealed upon Muhammed (sallallahu ‘alaihi wasallam). (Sunan Tirmizi #135)
Below is an inspiring incident Hazrat Ali (radhiyallahu ‘anhu) dealing with a person who was involved in fortune telling and predicting the future through stars:
On one occasion, Hazrat Ali (radhiyallahu ‘anhu) was traveling from the city of Ambaar moving towards the people of Nahrawaan to engage in jihaad against them. At the time when Hazrat Ali (radhiyallahu ‘anhu) was departing, a person named Musaafir bin Awf bin Ahmar came to him. Musaafir was an astrologer and fortune teller who would predict the future through looking at the stars. On coming to Hazrat Ali (radhiyallahu ‘anhu), Musaafir said to him, “O Ameer-ul-Mu’mineen! Do not set out and travel at this time! Rather, travel after three hours have passed!”
Hazrat Ali (radhiyallahu ‘anhu) was surprised and asked him, “Why should I delay my departure?” Musaafir replied, “The reason is that if you depart at this time, then you and your companions will be afflicted by great difficulty and will suffer great harm. However, if you travel at the time when I have recommended you to travel, then you will be successful and prosperous, and you will accomplish your goal.”
Hearing this, Hazrat Ali (radhiyallahu ‘anhu) responded saying, “Rasulullah (sallallahu ‘alaihi wasallam) did not accept the predictions of astrologers, and neither will we accept the predictions of astrologers after him! Tell me, do you know what is in the womb of my horse (i.e. can you tell me whether the foal is a male or a female)?” Musaafir replied, “If I try to make my calculations then I will be able to tell you the answer.”
Hazrat Ali (radhiyallahu ‘anhu) replied, “If any person believes what you have said, then he has rejected the Qur’aan Majeed. The reason is that Allah Ta‘ala says in the Qur’aan Majeed:
إِنَّ اللهَ عِنْدَه عِلْمُ السَّاعَةِ وَيُنَزِّلُ الغَيْثَ وَيَعْلَمُ مَا فِى الأَرْحَامِ وَمَا تَدْرِىْ نَفْسٌ مَاذَا تَكْسِبُ غَدًا وَمَا تَدْرِىْ نَفْسٌ بِأَىِّ أَرْضٍ تَمُوْتُ إِنَّ اللهَ عَلِيْمٌ خَبِيْرٌ
Indeed, Allah alone possesses the knowledge of the Hour (i.e. when Qiyaamah will occur); and He sends down the rain, and He knows what is in the wombs (i.e. the complete details of the child in the womb such as whether it will be a male or female, and all details pertaining to his or her life). No one knows what he will earn tomorrow, and no one knows in which land he will die. Surely, Allah is All-Knowing, All-Aware. (Surah Luqmaan v. 34)
Hazrat Ali (radhiyallahu ‘anhu) then said, “Nabi Muhammed (sallallahu ‘alaihi wasallam) did not claim to possess such knowledge which you claim to possess. Do you claim that you are able to calculate the time in which travellers are afflicted by evil and calamities?” Musaafir replied, “Yes, I am able to calculate this.” Hazrat Ali (radhiyallahu ‘anhu) said, “If any person believes what you have said, then he has disassociated himself from the belief that it is Allah Ta‘ala alone who can divert misfortune and calamities from him. The one who follows your advice should entrust his affair to you and take you as his rabb instead of Allah Ta‘ala. The reason is that you claim to be able to tell people the time in which a traveller will be saved from misfortune. If any person believes what you say, then I fear that he is equal to the one who ascribes partners to Allah Ta‘ala!”
Hazrat Ali (radhiyallahu ‘anhu) then said, “O Allah! There is no ill omen, except that which You declare as an ill omen, and there is no goodness besides the goodness which You bestow to a person, and there is none worthy of worship besides You!”
Hazrat Ali (radhiyallahu ‘anhu) then turned to Musaafir and said, “We reject what you have said and we will oppose you. We will travel at this time which you told us we should not travel in.” Thereafter, Hazrat Ali (radhiyallahu ‘anhu) turned to the people and said, “O people! I caution you and warn you against delving into this field of astrology, the only guidance which you should take from the stars is the guidance of navigation and direction when traveling in the land or at sea in darkness (as this is permitted in deen). The one who believes in astrology is a disbeliever, and the abode of the disbeliever is the fire of Jahannum.
“By Allah! If I hear that you are practising astrology and acting according to the predictions of astrology, I will throw you into prison and leave you there until you die or I meet my end. Furthermore, so long as I am the khalifah, I will not give you any allowance from the Bayt-ul-Maal.”
Hazrat Ali (radhiyallahu ‘anhu) then departed, traveling during the time which the astrologer had advised him was not good for travel. On reaching the people of Nahrawaan, Hazrat Ali (radhiyallahu ‘anhu) engaged in jihaad and was blessed with victory. He thereafter said, “Had we departed and travelled in the time when the astrologer advised us to travel, and we were thereafter victorious, then people would have said that it was due to following the astrologer that we were successful. Rasulullah (sallallahu ‘alaihi wasallam) did not take accept the predictions of astrologers, and neither will we accept the predictions of astrologers after him. Without us referring to any astrologers, Allah Ta‘ala blessed us with the conquest of the lands of Chosroes (the Persian ruler), Caesar (the Roman ruler) and many other lands.”
Hazrat Ali (radhiyallahu ‘anhu) then concluded saying, “O people! Place your reliance solely upon Allah Ta‘ala, and trust in Him alone, for He is sufficient for you against everything else.”
(Ithaaf-ul-Khiyarah #3960 and Musnad-ul-Haarith #564)