The Apostle Paul asked the Corinthians if they knew that they were the temple of God:
Know ye not that ye are the temple of God, and that the Spirit of God dwelleth in you (1 Corinthians 3:16)?
It was a reasonable expectation on Paul's part as 1 Corinthians was addressed to the saints of Corinth who were supposedly sanctified, that is, separated from sin (1 Corinthians 1:1-2). Jesus introduced the concept that His body was a temple:
Jesus answered and said unto them, Destroy this temple, and in three days I will raise it up (John 2:19) .... But he spake of the temple of his body (John 2:21).
The concept was difficult for the Jews to understand as they could only relate a temple to a physical structure:
Then said the Jews, Forty and six years was this temple in building, and wilt thou rear it up in three days (John 2:20)?
Jesus knew that the Holy Ghost would be given to anyone born again after He was glorified (John 7:38-39) and (John 3:3-5), and of course He was filled with the Spirit and He knew no sin:
For he hath made him to be sin for us, who knew no sin; that we might be made the righteousness of God in him (2 Corinthians 5:21).
Paul went on to say that if any man defile the God's temple, God will destroy him for God's temple is holy:
If any man defile the temple of God, him shall God destroy; for the temple of God is holy, which temple ye are (1 Corinthians 3:17).
What is it that defiles man? Sin! Jesus said:
But what comes out of the mouth proceeds from the heart, and this defiles a person. For out of the heart come evil thoughts, murder, adultery, sexual immorality, theft, false witness, slander. These are what defile a person....(Matthew 15:18-20 ESV).
The page, "What is Sin?" discusses sin in much more detail. But clearly, a person defiled by sin, will not inherit the kingdom of heaven:
Or do you not know that the unrighteous will not inherit the kingdom of God? Do not be deceived: neither the sexually immoral, nor idolaters, nor adulterers, nor men who practice homosexuality, nor thieves, nor the greedy, nor drunkards, nor revilers, nor swindlers will inherit the kingdom of God (1 Corinthians 6:9-10 ESV).
Or do you not know that your body is a temple of the Holy Spirit within you, whom you have from God? You are not your own, for you were bought with a price. So glorify God in your body (1 Corinthians 6:19-20 ESV).
We must, at all times live a repentant lifestyle, a life without wanton, willful sin in and when we do sin we confess our sins (1 John 1:9), and repent, turning fully back to Jesus Christ, going forward as a temple of God.