God uses sickness as a deterrent to sin. Illness can cripple or cut short the careers of evil people, like the self-glorifying Herod whom God struck dead with intestinal parasites (Acts 12:20-23). The sickness-curses of God's law were meant to deter rebellion against the Lord. God threatened the children of Israel with consumption, fever, inflammation, boils, tumors, scab and itch, madness, and blindness, if they rebelled (Deut. 28:22, 27-29, 35). Paul said that many in the Corinthians church were sick, and some had died, because they were spiritually violating the symbolism of the table of the Lord with their sins against the church (1 Corinthians 11:27-30). Paul told them this in order to bring about a change of behavior.
God uses sickness, and other afflictions, as a test of faith. Job did not bring his troubles upon himself, contrary to some foolish "name-it-and-claim-it" teachings I've read in the past. Job was a righteous man, and God praised him without reservation (Job 1:1, 8). Satan was filled with malice, and tried to prove Job was a hypocrite, just a worshiper-for-hire (1:9-11). God permitted Satan to afflict Job terribly (1:12, 2:6). God said this was His decision; Satan had no power to act contrary to God's ordinance (2:3). Job became a timeless example of enduring suffering, and received God's blessing at the end of it (James 5:10-11).
God uses sickness to bring lost people to Himself. Naaman was a Syrian army commander, afflicted with some sort of dreadful skin disease (2 Kings 5:1). He heard about the prophet Elisha through a servant girl, and sought Elisha's help. Elisha commanded him to dip himself in the Jordan River seven times. Naaman swallowed his pride, and did as he was told. God instantly healed Naaman of his terrible skin disease (2 Kings 5:13-14). In response, Naaman put his faith in the Lord God of Israel (5:15).
God uses sickness as a way to display His glory. Christ's disciples asked Him, "Who sinned, that this man was born blind? Him, or his parents?" Christ replied, "Neither sinned. This man was born blind so that the works of God may be revealed in him", and then He healed the blind man (John 9:1-7). This story is important because it reveals two important truths: first, that sickness is not always a punishment for personal sin; and second, that sickness is part of the ultimate plan of God, and under His control. As the Lord said to Moses: "Who gave human beings their mouths? Who makes them deaf or mute? Who gives them sight or makes them blind? Is it not I, the LORD?" (Exodus 4:11). Satan might be a secondary cause behind an illness, but he is not God's equal.
God uses sickness to create opportunities for witness. The apostle Paul said the reason he originally got to know the Galatians at all was because of some painful affliction that kept him there (likely an agonizing eye ailment, based on context -- see Galatians 4:13-15). There was nothing wrong with Paul's faith for healing, and Paul wasn't sinning. But God used him in this weakness to share the Gospel and so save the eternal souls of these dear people.
God uses sickness as a deterrent to pride (2 Corinthians 12:7-9). God gave Paul many astounding visions and revelations, but, to guard him against pride, God also gave him a "thorn in the flesh", a messenger from Satan to beat on him (v.7). This must have been a specific affliction, not just life's general troubles. It was a thorn in Paul's flesh (not in his mind/spirit), and whatever it was, it made Paul weak. It was not a result of sin in Paul's life. Rather, God used it as a preventative against pride. The Lord might have kept the specific nature of this thorn unclear, because its purpose and function are more important to know than its identity.
God accomplished complete healing for His people in His redeeming work, but has not applied it yet. If all the physical benefits of Christ's work were already operative, then none of us Christians would age or die. We are not Jews, and no longer living under the Old Covenant, so we have no right to claim the material benefits of Moses' Law. Christ has overcome all the side-effects of Adam's sin, but full manifestation of His victory sin won't take form until Christ returns. The whole material world groans now, including our bodies, and we are all longing for the day when Christ returns and the children of God enter into Christ's full inheritance (Romans 8:18-23).
God still heals in the meantime, but healing is not on an even par with forgiveness of sin. You never need to pray, "If it is your will", for the Lord's forgiveness and everlasting life. That's the chief blessing God offers in full right now. But Christ received an "If it be Thy will" prayer without rebuke,0 as true faith (Matthew 8:1-3). Satan works through the false teaching that Christ wants to heal every Christian at all times of every disease, by bringing a spirit of condemnation -- whether of one's self ("I must have a secret sin somewhere! I don't have enough faith!"), or of the brother or sister in the Lord ("If you had prayed in faith, I would have been healed! It's your fault I'm still sick!").