It is never a good idea to do what you have expressly been told by God not to do. But we all do it from time to time. The Israelites in exile took wives from the neighboring peoples. God had expressly commanded that they not do this from the time they first entered the promised land.
Like willful children, they did it anyway - not all of them, but some did. Returning to Jerusalem, they are returning to the laws of Moses as well. They needed to purify themselves to worship the Lord again in the temple. So they decided to send the foreign wives and their children away.
We are not told where these women and children went. Could they go back to their own families? What would have been their status in their own countries? I can't imagine that these women and children would have had easy lives after being sent away.
Did you ever notice that when man tries to make things right he sometimes messes up something else? God had told them not to do it. They did it anyway. Then when they try to fix their disobedience, they cause trouble for someone else.
The community of Israel spent two months looking at individual cases. We're not told how many, if any, were allowed to keep their foreign wives, but there is that possible inference in the text. Otherwise why judge individual cases.
How much simpler it would have been, had they just obeyed God in the first place. How much mess they made when they decided that they knew better than God.
Are we ever guilty of thinking we know better than God? Do we do things in disobedience that require fixing later - things that cost someone else?
Help us to remain ever obedient to You commands, no matter the circumstances in which we find ourselves. Remind us that we see only fragments while You see the whole picture.
In Jesus' most precious name.