The Prophet (may Allah's peace and blessings be upon him) points out that if a person acquires knowledge of the stars and planets and uses their movements and entry and exit as guidance for earthly events, like the birth of someone or his demise or illness, or any other future incident, he has thus learned part of magic, and the more he acquires of it, the more magic he learns.
Lessons
The Hadīth prohibits astrology, which is telling about the future based on the conditions of the stars, for this falls under the claim of knowing the unseen.
The prohibited astrology belongs to the types of sorcery that contradict monotheism. But it is permissible to look at the stars to determine the directions, the Qiblah, or the commencement of seasons and months.
The more a person learns about astrology, the more branches of magic he learns.
There are three benefits from the stars Allah has mentioned in His Book: an adornment for the sky, signs to serve as guidance, and missiles for stoning the devils.
Explanation in Arabic
يُبَيِّنُ النبيُّ صلى الله عليه وسلم أنَّ مَن تَعَلَّم وأَخَذَ من علم النجوم والأبراج والاستدلال بحركاتها ودخولها وخروجها على الحوادث الأرضية من موت فلان أو حياته أو مرضه، ونحو ذلك مما سيقع في المستقبل، فقد تَعَلَّمَ جزءًا من السحر، وأنه كلَّما أكثر الإنسان هذا العلم فقد أكثر من السحر.
تحريم التنجيم الذي هو الإخبار عن المستقبل اعتمادًا على أحوال النجوم؛ لأنه من ادعاء علم الغيب.
أن التنجيم المُحَرَّم من أنواع السحر المنافي للتوحيد، بخلاف النظر في النجوم لمعرفة الاتجاهات أو القِبْلة أو دخول المواسم والشهور فهو مباح.
كلما زاد في تَعَلُّمِه للتنجيم فهو يزيد من تَعَلُّمِ شُعَبِ السحر.
للنجوم ثلاث فوائد ذكرها الله في كتابه: زينة للسماء، وعلامات يهتدى بها، ورجوم للشياطين.