What did Shlomo do for all his wives?
Malbim: He did not protest against their idolatry.
Malbim citing Mahari: Shlomo understood the essence, of the Nivdalim 1 , and how they conduct the lower beings, and the ways, intermediaries and preparations needed for each Sar to draw influence to its nation. In his old age, Shlomo taught his wives the ways of serving their idolatries (these Sarim). This was a great sin, both engaging in knowing this, and teaching it to his wives after they converted 2 , especially in Yerushalayim, which Hashem chose for His residence.
Ramban (Shemos 20:2): The angels are Sichlim Nivdalim (purely intellectual, not connected to any physical body). Every nation other than Yisrael has a Sar appointed over it. It is an advocate for its nation, to bring blessings and influence from above, but it has no independent power.
Also before they converted, idolatry is forbidden to them, and Shlomo would transgress "v'Lifnei Iver Lo Siten Michshol" (Vayikra 19:14). One may learn for the sake of understanding and ruling (Sanhedrin 68a, based on Devarim 18:9; the verses there discuss matters like witchcraft, but it includes idolatry (Me'iri 67b).