Erwin R. Goodenough in his monumental book, Jewish Symbols in the Greco-Roman Period, Volume two, Pantheon Books, 1953, New York, chapter six, p. 170 talks about Jewish charms and amulets, from Christian sources, where King David (also named Davithea) appears. Goodenough answers our question very elegantly:
Since David by his singing drove the evil spirit out of Saul (I Sam, xvi, 23) his appearance in such a role seems inevitable”.
A good example Goodenough brings for such an appearance of King David on a charm is from page 166:
I adjure thee today, Davithea
Thou who liest there upon the bed of the Tee of Life,
In whose right hand is the golden bell,
In whose left hand is the lyre of the spirit
When he gathers all the angles for the salutation of the Father.
I adjure thee today, Davithea, Eleleth,
In the name of the seven holy archangels,
Michael, Gabriel, Suriel, Raphael, Asuel, Sarapuel, Abael-
That is those who stand at the right hand of the Father…
Gershom Scholem, the authoritative researcher of the Star of David, wrote in the Encyclopedia Judaica:
In magical Hebrew manuscripts of the later Middle Ages, the hexagram was used for certain amulets…but Goodenough shows that David is mentioned as a protector (without his shield) much earlier than “later Middle Ages”.
IMHO we can learn from Goodenough a very important lesson about the history and the meaning of the six pointed star: In the Greco-Roman Period the figure of King David was used as a protecting figure and only many hundred years later, in the Middle Ages, David the protector from the charms and amulets got his shield.