Answer
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
If you did not read the book on astrology to learn the art, but you ended up reading something about in a book that deals with another topic, then that is not considered as sinful.
In responding to your question, Sheikh Ahmad Kutty, a senior lecturer and an Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states:
If you did not read the book on astrology to learn the art, but you ended up reading something about in a book that deals with another topic, then that is not considered as sinful.
According to scholars, those who cite the beliefs of the enemies of Islam or study them for the sake of refuting them or knowing where they come from are not guilty.
As students of Islam, our course of studies included the study of pre-Islamic poetry; we were often encouraged to memorize them; it was done to help the students master the Arabic literature to understand the Quran better.
Likewise, if you were studying English literature and the curriculum included some texts with obscene contents, it is not sinful on your part to read it as long as you take care not to be influenced or corrupted by it.
The Quran cites some of the arguments of the believers, including their blasphemous statements about Allah and His Messenger. They are cited to present the teachings of Islam in context.
In conclusion, it is allowed for you to read a book containing such sections, but take care not to believe in them and ask Allah forgiveness. And continue to pray to Allah using this Duaas:
Rabbanaa laa tuzhgh quloobanaa ba’da idh hadaythanaa wa hab lanaa min ladunka rahmathan innaka antha al-wahhaab
(Our Lord, do not let our hearts swerve from the path (of truth) after You have guided us and grant us mercy for You are the dispenser of mercies)
Allaahumma yaa muqalliba al-quloob thabi qalbee alaa deenika
(O Allah, You are the Twister and Turner of hearts, make our hearts firm on Your religion.)
Almighty Allah knows best.