Question: I am confused by an Old Testament passage, Ezekiel 18:21-23, that seems to say that you must turn from your sin to be saved.
Answer: The best way to seek your answer is to begin by quoting the passage in question.
"But if the wicked will turn from all his sins that he hath committed, and keep all my statutes, and do that which is lawful and right, he shall surely live, he shall not die. (21) All his transgressions that he hath committed, they shall not be mentioned unto him: in his righteousness that he hath done he shall live. (22) Have I any pleasure at all that the wicked should die? saith the Lord GOD: and not that he should return from his ways, and live?" - Ezekiel 18:21-23
Turning from your sin will not save you. It is believing that Jesus Christ died to pay for your sin that gives you eternal life. No one was ever saved by keeping the Law, as it only showed us we were sinners in need of a Savior. Romans 3:20 is emphatic on this point,
"Therefore by the deeds of the law there shall no flesh be justified in his sight: for by the law is the knowledge of sin."
We are all born sinners, because each person inherits the sin nature of Adam. (Romans 5:12). The only means of redemption is,
"Being justified freely by his grace through the redemption that is in Christ Jesus:" - Romans 3:24
Strictly applied, Ezekiel 18:21-23 is a warning to a person, in Old Testament times, who was being disobedient to the Law, to come back to its statutes and obey the Lord. "...do that which is lawful and right, he shall surely live, he shall not die." If he does so, God will not chasten, "he shall surely live, he shall not die." God will forgive, "All his transgressions that he hath committed, they shall not be mentioned unto him:"
This has nothing to do with salvation; but, teaches obedience to the Lord. However, the Apostle Paul states of the Old Testament Scriptures in Romans 15:4, "...whatsoever things were written aforetime were written for our learning..." This is the same principle for having fellowship with our Lord that is reiterated in the New Testament in 1 John 1:7,8,9.
Note: Also see Section XIV. “Salvation”