I realize another answer has been accepted, but I doubt that the Pharisees really did what is reported. In my view, the reason the Pharisees are reported to do this is because at the time the story was written or inserted, there was a controversy in the church over whether the church was only for saints, or whether it should include sinners as well. The Pharisees represent churchmen who wanted to exclude habitual sinners. Jesus represents those who wanted to include them. The former view is represented for example by The Shepherd of Hermas, a highly popular work which warns that sins after baptism will not be forgiveness. The latter by the emerging tradition of confession and forgiveness of post-baptismal sins.
The story does not exist in the earliest manuscripts. Manuscript History and John 8:1-8:11 by Chris Keith reports:
Interestingly enough, the earliest manuscripts of the Gospel of John do not contain this beloved passage. Indeed, the first manuscript to contain the story is from around 400 C.E. Around 4% of Greek manuscripts that include the passage place it in locations other than John 8:1-8:11; the earliest of these is from around the ninth and tenth centuries C.E. This perplexing manuscript history fuels debates about whether the story was originally in John’s Gospel and, if so, where. The majority of scholars believe a later Christian scribe inserted the passage into John’s Gospel at John 8:1-8:11
It is debatable whether the Pharisees of this time would have had women stoned for adultery. The Gospels are our main source for the issue of capital punishment in the 1st c. so we can't say for certain, but the Talmud quotes 2nd c. rabbis as being against it. The Talmud states:
A Sanhedrin that executed one person in a week is called a “murderous” [court]. Rabbi Elazar ben Azarya states: “Even one person in 70 years [would be denoted a murderous court].” Rabbi Tarfon and Rabbi Akiva state: “If we had been members of the Sanhedrin, no defendant would ever have been executed.”
So IMO the answer to the question is that the story was not part of the original Gospel of John and the reason these Pharisees try to trap Jesus is that the author [or the person who inserted the story] wanted to portray exclusivist churchmen of his day as heartless while portraying his inclusive view as in line with what Jesus would have done.