Shaykh Haamid al-‘Ali was asked on his website about this question and he said: The Muslim should be sure of three things when he hears this kind of news:
1 – That life on earth will never come to an end except as described in the Book of Allaah and the Sunnah of His Prophet (peace and blessings of Allaah be upon him). The end of history will never occur before the emergence of all of the lesser and greater signs of the Hour. One of those signs is that there will be conflict between the people of truth, who are the Muslims, and the people of evil and falsehood, who are all of those who oppose the religion of truth, Islam, and strive to extinguish its light. There are two distinct features of this conflict which will occur before the end of life. The first is a conflict between the Muslims and the people of the cross, as is mentioned in the saheeh ahaadeeth which speak of the battles at the end of time.
The second is the battle between the Muslims at the time of the descent of ‘Eesa (peace be upon him) with the Dajjaal and his followers among the Jews. Then Ya’jooj and Ma’jooj (Gog and Magog) will appear, and they will die as one.
Then the Muslims will rule the earth, then everyone in whose heart is faith equal to a grain of corn will die, when a cold wind blows that will take the souls of the believers. Then the Hour will begin soon after that and it will come upon the most evil of people who are scattered throughout the earth. The universe will not be destroyed when there is still one believer on earth, but when faith is gone it will be destroyed, because belief in Allaah is a reason for life to continue.
The point is that it is not permissible for a Muslim to believe that the end of the world will occur in a manner different to that which is mentioned in the proven texts of the Book of Allaah and the Sunnah of His Prophet (peace and blessings of Allaah be upon him).
2 – It is not permissible for a Muslim to believe that heavenly bodies can bring benefit or ward off harm, or that they can bring provision or bring joy or sorrow, or that they have any control on the lives of men, and so on. This is a polytheistic belief (shirk) which is held by people of Jaahiliyyah. It is stated in the saheeh ahaadeeth that whoever believes in this is guilty of kufr. Thus it is clear that all claims made by astrologers are lies, kufr and shirk (the association of others with Allaah, may He be exalted).
The planets are no more than bodies that are subject to the decree of Allaah and play their role in the universe. This does not mean that they do not behave according to the natural laws according to which Allaah has established the universe or have an effect on one another, as a result of which calamities, disasters and earthquakes occur. Shaykh al-Islam Ibn Taymiyah mentioned that eclipses affect the earth. The Prophet (peace and blessings of Allaah be upon him) said: “A sign by means of which Allaah instils fear in His slaves” i.e., it points to the approach of events that have been decreed by Allaah, may He be glorified and exalted, in order to instil fear and remind people of Allaah, an eloquent reminder of His power, a reminder of the end of the world, a reminder to him not to transgress and to remember always that he is on the earth of Allaah which, if He willed, He could cause to shake beneath his feet, and he would not be able to do anything.
Hence earthquakes usually happen after eclipses, as do destructive storms. We seek refuge with Allaah from His wrath. He mentioned that the Prophet (peace and blessings of Allaah be upon him) sought refuge with Allaah from the moon, because it has an effect, otherwise why would he seek refuge from it? But its effect is physical in nature like other physical effects that Allaah has created.
So long as the Muslim believes that this all happens by the will and decree of Allaah, and that they are signs by means of which Allaah instils fear in His slaves, then it does not matter. But it is essential to understand the relationship between the movement of the planets and the sun and the movements of the earth, and the layers of the earth and the movement of the winds, on a scientific basis, and the interaction of natural scientific laws. Islam does not forbid that, rather it enjoins us to discover the laws of the universe that Allaah has created.
3 – It is not permissible for a Muslim to ignore the ahaadeeth in which the Prophet (peace and blessings of Allaah be upon him) spoke of what is to happen in the future in favour of what is said by scientists and astronomers whose words may be based on conjectures or expectations which soon be shown to be wrong. It is not valid for anyone to say that the fall of America, the emergence of the Mahdi, or the change in the global system or the balance of power will come as the result of the movement of the planets which will have a disastrous effect on the earth, in such and such a year, etc.
Whoever states such a thing is speculating and speaking without knowledge, speaking about the unseen with no knowledge. If he is speaking within the framework of possibility, and what could happen, well many things could happen, but no one knows what is going to happen, and when, except Allaah alone.
We have been commanded to strive against our enemies with what we have been given of strength, and to strive to surpass them, or to be equal to them, or to come close to them in terms of the physical and moral resources that they have, and not to rely on natural calamities to destroy our enemies.
We know from the seerah of our Prophet (peace and blessings of Allaah be upon him) that we should face our enemies with reliance upon Allaah first and foremost, then by means of the deep faith in our beliefs that Allaah has given us, and with firm resolve to reclaim our rights, patience in adhering to our path and persistence in conveying the message and ongoing jihad, until we reach our goal and our highest aim, which is to lead mankind to guidance and light, so that all of mankind may enjoy the message of mercy with which our Prophet (peace and blessings of Allaah be upon him) was sent. This is what he (peace and blessings of Allaah be upon him) did during his lifetime, and we have the best of examples in him.
After this, we say that what this speaker has said about the planet Nibiru is worthless until it is proven by sound scientific evidence. If this planet is to have a destructive effect by passing close to the earth, and that is proven, then what we have to do is adhere to the three guidelines mentioned above, and turn to Allaah, praying to Him to avert disaster, and if it happens to relieve us of it, and to make the consequences better for us and the Muslims.
But we think that everything that is said about this planet is a fabrication that has no basis in truth, or it is an exaggeration, and it is unwise to pay any attention to it.
And Allaah knows best.
What the questioner mentioned in his question has occurred in the past, and nothing happened, which confirms the idea that this is speculation and speaking without knowledge.