The Lord told Ezekiel to let the Jewish exiles among whom he lived witness his groaning, grief, and heartbreak as he delivered this message. When the people asked the prophet why he was so sad, he was to tell them that it was because of the coming judgment. [source][source][source]
"The need for the action described in these verses suggests that Ezekiel"s oral presentation so far had failed to impress his audience. Since they would not be shocked, even by the reference to the righteous perishing with the wicked, a new rhetorical strategy is adopted. Yahweh orders the prophet to perform another sign-act before his hearers. The performance involved paralinguistic nonverbal groaning, normally expressive of the deepest pain and grief." [1][source]
"God would have Ezekiel experience something of what was in His own heart toward the rebellious nation." [2][source]
Ezekiel"s grief would mark the people to whom he spoke this prophecy when they heard the news that the sword was coming. And the Lord guaranteed that the judgment would indeed come. [source][source][source]