A Commentary, Critical, Practical, and Explanatory on the Old and New Testaments, by Robert Jamieson, A.R. Fausset and David Brown  at sacred-texts.com
num 25:1THE ISRAELITES' WHOREDOM AND IDOLATRY WITH MOAB. (Num. 25:1-18)
Israel abode in Shittim--a verdant meadow, so called from a grove of acacia trees which lined the eastern side of the Jordan. (See Num 33:49).
num 25:3Israel joined himself unto Baal-peor--Baal was a general name for "lord," and Peor for a "mount" in Moab. The real name of the idol was Chemosh, and his rites of worship were celebrated by the grossest obscenity. In participating in this festival, then, the Israelites committed the double offense of idolatry and licentiousness.
num 25:4The Lord said unto Moses, Take all the heads of the people, and hang them up--Israelite criminals, who were capitally punished, were first stoned or slain, and then gibbeted. The persons ordered here for execution were the principal delinquents in the Baal-peor outrage--the subordinate officers, rulers of tens or hundreds.
before the Lord--for vindicating the honor of the true God.
against the sun--that is, as a mark of public ignominy; but they were to be removed towards sunset (Deu 21:23).
num 25:5judges of Israel--the seventy elders, who were commanded not only to superintend the execution within their respective jurisdictions, but to inflict the punishment with their own hands. (See on Sa1 15:33).
num 25:6behold, one of the children of Israel . . . brought . . . a Midianitish woman--This flagitious act most probably occurred about the time when the order was given and before its execution.
who were weeping before the door of the tabernacle--Some of the rulers and well-disposed persons were deploring the dreadful wickedness of the people and supplicating the mercy of God to avert impending judgments.
num 25:8the plague--some sudden and widespread mortality.
num 25:9those that died in the plague were twenty and four thousand--Only twenty-three thousand perished (Co1 10:8) from pestilence. Moses includes those who died by the execution of the judges [Num 25:5].
num 25:11Phinehas . . . hath turned my wrath away--This assurance was a signal mark of honor that the stain of blood, instead of defiling, confirmed him in office and that his posterity should continue as long as the national existence of Israel.
num 25:14Zimri, . . . a prince . . . among the Simeonites--The slaughter of a man of such high rank is mentioned as a proof of the undaunted zeal of Phinehas, for there might be numerous avengers of his blood.
num 25:17Vex the Midianites, and smite them--They seem to have been the most guilty parties. (Compare Num 22:4; Num 31:8).
num 25:18they vex you with their wiles--Instead of open war, they plot insidious ways of accomplishing your ruin by idolatry and corruption.
their sister--their countrywoman.