This passage presents a frightening picture. We read about swords and arrows, pits, ditches and death. God is angry and is judging sin, and He hears David's petition about his persecutors: "O Lord, they are accusing me of something I didn't do. They are Lying about me." That's tough to take. People lied about the Lord Jesus, too. And anyone who tries to live like Him is going to suffer this kind of persecution. David's enemies wanted to kill him. Some innocent men had been killed because of him. But David was praying that God would first cleanse his own heart. He said, "Examine me. Look at me. Test me. I want to be sure my life is ruled by integrity."
Sin brings its own judgment. "Behold, the wicked travails with iniquity, conceives trouble and brings forth falsehood" (v. 14). This is a picture of pregnancy and birth. When a person conceives sin and then gives birth to it, he gives birth to a monster that will turn on him and destroy him. David changed the picture in verses 15 and 16: "He made a pit and dug it out, and has fallen into the ditch which he made. His trouble shall return upon his own head." That's a word of encouragement and also a warning. We can't give birth to sin without having to live with the baby, watching it grow up and create problems. Yes, God in His grace forgives. But God in His government says, "We must reap what we sow."
The warning here is don't give birth to sin. There's also an encouragement: If others are giving birth to sin, don't fret over it but pray for them.
What is your response when others do their worst to you? Be encouraged that God knows what is happening and will judge sin. If you take care of yourself and walk with integrity, you may be confident that God will deal with those who sin against you. Above all, don't give birth to sin yourself; rather, pray for those who persecute you. God will one day turn your persecution into praise.