Ezekiel16 is an extended analogy, a sexually explicit oracle of judgment against Jerusalem. Jerusalem was the unwanted child of pagan parents. Exposed to die, she was rescued by YHWH (vv.1-5). She grew to sexual maturity without clothes (vv. 6-7). YHWH dressed her in finery, married her, and fed her with sumptuous fare. She became a queen, a famous beauty (vv. 8-14). But she became a prostitute, explicily a metaphor for idolatry. Worse, she commits child sacrifice. (vv.15-22). Jerusalem's idolatry and foreign alliances are described in pornograpic terms:
At every street corner you built your lofty shrines and degraded your beauty, spreading your legs with increasing promiscuity to anyone who passed by. You engaged in prostitution with the Egyptians, your neighbors with large genitals, and aroused my anger with your increasing promiscuity.
(Ezekiel 16:25-26 NIV)
Jerusalem has committed adultery with the Egyptians, Assyrians, and Babylonians. Even the Philistines are shocked at her behavior (v. 27). She has been worse than a prostitute. She didn't even take payments; she gave them! (I assume this refers to the payment of tribute to conquering nations.
So, angry husband YHWH plans to give Jerusalem over to her lovers to be abused.
Then I will deliver you into the hands of your lovers, and they will tear down your mounds and destroy your lofty shrines. They will strip you of your clothes and take your fine jewelry and leave you stark naked. They will bring a mob against you, who will stone you and hack you to pieces with their swords. They will burn down your houses and inflict punishment on you in the sight of many women. I will put a stop to your prostitution, and you will no longer pay your lovers.
(Ezekiel 16:39-40 NIV)
Then, YHWH says, he will quit being angry.
Verses 44-52 repeat Jerusalem's ignoble parentage and introduce her two sisters: Samaria (capitol, you will recall of the nothern kingdom) and Sodom. Both of these sister cities now lie in ruins. Sodom's sins are detailed in verses 49-50:
Now this was the sin of your sister Sodom: She and her daughters were arrogant, overfed and unconcerned; they did not help the poor and needy. They were haughty and did detestable things before me. Therefore I did away with them as you have seen.
We may note that, in this sexually explicit chapter, the sins of Sodom do not explicitly include homosexuality.
Verses 53-62 promise that Sodom, Samaria, and Jerusalem will be restored. YHWH will make an everlasting covenant with Jerusalem. She will not, however, get over being ashamed.
It is interesting that my go-to translation, the New Revised Standard Version, is less explicit than the NIV in chapter 16.
Chapter 17 brings us another oracle in the form of an allegory. Here, Judah is a lofty sprig from the high branches of a noble cedar. An eagle representing Babylon carries it away and plants it in a distant land where it becomes a vine. The vine llooks to another eagle, Egypt, for help. Egypt is of no use. But, YHWH will plant a cedar sprig on a high mountain where it will flourish and become a tree. In other words, Jerusalem will be restored.
Next: Ezekiel 18-20