The Pharisees sinned. They broke the law in an effort to discredit Christ. The law stated they needed an eyewitness, and not just one but 2 or 3. They had none. The punishment for breaking the law was the punishment that they intended for her, stoning. In the passage the oldest drop their stones first as they KNEW they broke the law. That is why Jesus said "He who is without sin cast the first stone". None could without condeming themselves.
Deuteronomy 19:15
One witness is not enough to convict anyone accused of any crime or offense they may have committed. A matter must be established by the testimony of two or three witnesses.
Deuteronomy 19:18-19
The judges shall inquire diligently, and if the witness is a false witness and has accused his brother falsely, then you shall do to him as he had meant to do to his brother.
The Pharisees broke at least 3 laws.