The New Testament quotes this verse in a form noticeably different from the Hebrew.
Quick answer
An argument from the lesser to the greater: if the good are dealt with in this life, the wicked certainly will be. The verse closes the chapter on accountability.
Read both lines
The reasoning runs upward. If even the righteous receive what is due them here, on the earth, then no one should expect the ungodly to escape. The NKJV footnotes "recompensed" as rewarded, and the neutral sense is the right one: the word covers being repaid in either direction. What the verse claims is not that every account is settled visibly, which the rest of Scripture plainly denies, but that the present world is not a place where conduct simply floats free of consequence.
Why translations differ
Peter quotes this verse, and the version he quotes reads differently: "If the righteous one is scarcely saved, where will the ungodly and the sinner appear?" (1 Peter 4:18). The Hebrew as the NKJV renders it speaks of the righteous being recompensed on the earth; the form Peter cites speaks of the righteous being scarcely saved. The difference reflects the Greek translation of the Old Testament that the New Testament writers commonly used, and it is a clear example of a New Testament author quoting a text in a form that does not match the Hebrew word for word. Both are in the Bible, and neither reading is a mistake to be resolved away.
Related: 1 Peter 4:18 · Proverbs 11:8 · Proverbs 11:21
New King James Version®, Copyright © 1982, Thomas Nelson. All rights reserved. Full copyright information. Scripture provided by API.Bible.
Go Deeper
If this verse has been used to put weight on you that it was never carrying, ask about it directly.