Completing a spiritual and moral revolution in the Kingdom of Judah required confronting deep-rooted practices of idolatrous worship and promiscuity that had survived earlier reforms. Jehoshaphat faced the challenge of eradicating a widespread culture of public adultery and prostitution [רש״י, מצודת ציון].
The exact identity of those involved in these acts involves different perspectives. Some view them specifically as male prostitutes who participated in these acts as an integral part of pagan rituals [רלב״ג, ביאור שטיינזלץ]. Others understand the group more broadly, encompassing female prostitutes, men engaging in prostitution, or individuals exclusively dedicated to the worship of the Asherah [רד״ק, אברבנאל].
To cleanse the land, Jehoshaphat undertook a campaign of absolute removal, ensuring these individuals and their practices were entirely eradicated from the world [מצודת ציון]. This sweeping action was the culmination of a process initiated by his father, Asa. While Asa had started the battle against this shameful and overt idolatry, he was unable to destroy it entirely, leaving remnants of these practices in the land. By stepping into his father's footsteps, Jehoshaphat finally completed the mission, purging the kingdom of these corrupt influences once and for all [ביאור שטיינזלץ, אברבנאל].