“‘Let any one of you who is without sin be the first to throw a stone at her.’ Again he stooped down and wrote on the ground. At this, those who heard began to go away one at a time, the older ones first, until only Jesus was left, with the woman still standing there.” John 8:7-9
Perhaps seeing Jesus write, reminds them of God writing the 10 commandments. Regardless, Jesus is reminding them of God’s holiness which causes them to remember their own failures. They become keenly aware of their own guilt and lose the desire to judge another.