What most people don't realize is that magic is a consistent feature of the Bible, especially the Old Testament. It was a part of normal religious experiences and daily life at that time. First I must discuss the erroneous view that the Bible condemns the practice of all magic. The key word here is all. There are many forms of magic, including black magic and white magic, and there are all kinds of in between.
For arguments sake, lets say there are ten different kinds of magic, and two of them are considered black or evil magic. The Bible does condemn these two forms, but it accepts the use and practice of the other eight. So, many thin that, since some forms of magic (black or evil) are condemned in the Bible, all forms of magic are. Many, if not all, biblical patriarchs like Abraham, Moses and Joseph magic was accepted religious practice. The bible is very clear on this, and the examples are numerous.
Another reason for the confusion is that the Bible uses two different words for spiritual entities, daimon and diabolos. Diabolos refers to God's adversary, which we call Satan. Daimon refers to all other spiritual entities and beings, many of whom are good. Unfortunately, the early English translations of the Bible, including the King James version, have translated these two different terms as one term, Diabolos, thereby lumping the good angels, the bad angels, and spiritual entities together erroneously.