“pagan shrines.” The Hebrew word “shrines” is bamot, which referred to a place that was leveled and built up and on which were placed various idols and objects of worship. Many of the towns had such shrines (see commentary on Num. 33:52).
“to prostitute themselves.” Both physically and spiritually. Ritual sex was often a part of the worship of pagan gods.