Rabbeinu Bahya, Devarim 17:17:1
ולא ירבה לו נשים, “and he shall
not have too many wives.” Our sages (Sanhedrin 21) put the number of wives a
king may have at 18. They base this on the number of wives David had, six of
whom were mentioned by name (Samuel II 3,2-5). It says there: “if this is
insufficient, I will add for you כהנה וכהנה “twice more the same number,” i.e.
another 12 (Samuel II 12,8). The reason the Torah gives for this limitation is:
ולא יסור לבבו, “so his heart will not go astray.” It is assumed that a woman
may seduce a man to turn from being G’d-fearing, seeing that the original woman
Chavah had done exactly that when she seduced Adam into eating from the tree of
knowledge (Genesis 3,6). (source)