Ezekiel 23 is a parallel to chapter 16, an allegory God gave Ezekiel about two sisters, the daughters of one mother. Oholah stood for Samaria. Oholibah stood for Jerusalem, where God's temple stood. Her name is often explained as pointing to God's tent in her. Both belonged to God and were meant to be faithful to him alone. The chapter describes their unfaithfulness in strong adult language; its point is that they gave the loyalty they owed God to the nations and their gods.
The story traces Israel's foreign policy as spiritual unfaithfulness. Samaria trusted Assyria's governors and horsemen and took up their idols, until Assyria destroyed her. Jerusalem, who should have learned, was worse than her sister. She courted Assyria, then Babylon, and then turned back to Egypt, the very land from which God had rescued Israel. Each alliance brought its gods into God's house.
God's verdict is clear. Because Jerusalem had forgotten God and cast him behind her back, she would bear the consequences. They have defiled my sanctuary in the same day, and have profaned my Sabbaths. Because Jerusalem walked in the way of her sister, God would give her sister's cup into her hand, the cup of astonishment and desolation. The chapter warns that privilege, even having God's temple, does not protect people who forsake him. In the New Testament, 1 Corinthians 10:12 says: Therefore let him who thinks he stands be careful that he doesn't fall.