Maharal (Shabbos 156a): Pesachim (113b) says it is prohibited to consult with an astrologer because of the verse be tamim with your G d.
Maharal (Shabbos 156a): The prohibition of consulting with an astrologer is going to ask one but there is nothing wrong with studying astrology. Someone who knows astrology should utilize this knowledge to protect himself since G d made them to have influence. Thus the only prohibition is asking them not utilizing this information.
Pesachim (113b) How do we know that you must not consult astrologers? Because it is said: Thou shalt be whole-hearted with the lord thy God.
Shulchan Aruch (YY 179) We do not make inquiries to astrological seers, nor to the fates. [Comment of Rema: Because it is said, "You must be wholehearted with the LORD your God." (Deuteronomy 18:13) (B"Y citing Tosafot (???) and citing Sifrei) And certainly it is prohibited to make inquiries to magicians, diviners, and sorcerers. (Piskei Mahara"i 96)]
Netziv (Devarim 18:14): According to our explanation of Temimos as feeling completely secure and not worrying, why does the Torah recommend that one should be temimos and not go to astrologers but yet should consult instead the prophets about the future? The answer is that in general a person’s conduct in this world should be with simple trust in G-d and not to investigate the future - …. Nevertheless at a time of war when it is not clear what to do and it is a life threatening situations one must search to know what to do. … However it is obvious that at a time when there is no prophet it is necessary to use divination techniques….However not everything that an individual wants to know can he receive answers from a prophet. We see even for Moshe Rabbeinu (Moed Koton 16) that he only learned of the negative comments of Dasan and Aviram because of the messenger but not from his powers of prophecy. So surely this limitation on knowledge is true of other prophets. … .In contrast there is no such limitation for magic and divination which is the result of hidden natural processes and when someone uses them to know that which he needs he is merely using these natural processes which were produced by G-d .
Or HaChaim (Devarim 18:14): Jews were given prophets so that they would not be in an inferior to non Jews in terms of knowing the future. Perhaps that was Shaul’s understanding when he made inquiries of a diviner (Shmuel I 28:7) because G-d did not prohibit using diviners except when there are prophets. However when there are no prophets and there is a need to know diviners can be consulted.