The Messenger of Allah ﷺ said, "Whoever acquires a branch of knowledge from astrology has acquired a branch of magic, increasing in proportion to what he has gained."
قال رسول الله ﷺ: من اقتبس علما من النجوم اقتبس شعبة من السحر زاد ما زاد.
Abu Dawud (3905) and Ibn Majah (3726) narrated it through Yahya bin Saeed, from Ubaydullah bin Akhnas, from Walid bin Abdullah, from Yusuf bin Mahak, from Ibn Abbas, and mentioned it. Its chain of transmission is sahih. Ubaydullah bin Akhnas is trustworthy according to the majority of the leading scholars, such as Ahmad bin Hanbal, Ibn Main, Abu Dawud, and Nasai, and the two Shaykhs relied on him in their Sahihs, and likewise the rest of the authors of the six books cited him.