While Israel lived in Shittim, the people began to whore with the daughters of Moab. These invited the people to the sacrifices of their gods, and the people ate and bowed down to their gods. So Israel yoked himself to Baal of Peor. And the anger of the LORD was kindled against Israel. And the LORD said to Moses, “Take all the chiefs of the people and hang them in the sun before the LORD, that the fierce anger of the LORD may turn away from Israel.” And Moses said to the judges of Israel, “Each of you kill those of his men who have yoked themselves to Baal of Peor.”
And behold, one of the people of Israel came and brought a Midianite woman to his family, in the sight of Moses and in the sight of the whole congregation of the people of Israel, while they were weeping in the entrance of the tent of meeting. When Phinehas the son of Eleazar, son of Aaron the priest, saw it, he rose and left the congregation and took a spear in his hand and went after the man of Israel into the chamber and pierced both of them, the man of Israel and the woman through her belly. Thus the plague on the people of Israel was stopped. Nevertheless, those who died by the plague were twenty-four thousand. (Numbers 25:1-9 ESV)
Whereas the king of Moab cannot get Balaam to bring God’s curse down on Israel, Israel brings down His curse by their willingness to enter into sexual and spiritual relationship with the women of Moab and Midian. They allow their relationships with these women to influence their worship, bowing down to and bonding themselves to Baal. There were many versions of Baal worship, local or national versions, but they all involved re-enacting the fertilization of the earth by Baal. The sexual act was part of Baal worship.
This apostasy is so heinous that the punishment is death and public exposure by hanging the dead body on a pike. Phinehas understands the seriousness of the rebellion and kills an Israeli man in the act of taking a Midianite woman in marriage. This stops Yahweh’s plague but still many are killed. This was a wide scale abandonment of Yahweh.
God has big visions for us but we must stay in obedience to realize them. And that includes having our most intimate relationships be with those who also follow Christ and not yielding to the influence of the ungodly. As the apostle Paul said,
Do not be unequally yoked with unbelievers. For what partnership has righteousness with lawlessness? Or what fellowship has light with darkness? What accord has Christ with Belial? Or what portion does a believer share with an unbeliever? What agreement has the temple of God with idols? For we are the temple of the living God; as God said,
“I will make my dwelling among them and walk among them, and I will be their God, and they shall be my people. Therefore go out from their midst, and be separate from them, says the Lord, and touch no unclean thing; then I will welcome you, and I will be a father to you, and you shall be sons and daughters to me, says the Lord Almighty.” (2 Corinthians 6:14–18, ESV)