First. What happened is that God answered prayer. It says right there in the passage: "The effectual fervent prayer of a righteous man availeth much."
Second. There is no God-given promise that the person will be healed. God heals according to his will. Paul was not healed of his thorn in the flesh (an infirmity). Timothy was not healed of his many stomach infirmities. Epaphrodites was so sick Paul describes him as "nigh unto death," and did not heal him. Paul also said, "Trophimus have I left sick at Miletus," even though Paul had the gift of healing, as he did all the gifts of the Spirit (2Cor.12:12).
--It is not God's will that all be healed.
However there were times in the apostles' ministry that they could heal all that came to him. Then they exercised the "gift of healing."
When Jesus did such it was to demonstrate His deity.
When the Apostles healed all (Acts 5:16), it was to authenticate them as apostles and their message as being from God.
This has already been shown to you that Paul's thorn was not sickness!
Paul tells us exactly what it was: It was a "messenger of Satan" (2 Corinthians 12:7). Paul didn't use a Greek word for sickness or disease in this verse, but instead he specifically used the Greek word for "angel," and he specifically said that it was a demonic angel.
2 Corinthians 12:7: "To keep me from becoming conceited because of these surpassingly great revelations, there was given me a thorn in my flesh,
a messenger [angelos]
of Satan, to torment me."
2 Corinthians 12:8: "Three times I
pleaded with the Lord to
take it away from me." 2 Corinthians 12:9: "But he said to me, "My grace is sufficient for you, for my power is made perfect in weakness." Therefore I will boast all the more gladly about my weaknesses, so that Christ's power may rest on me."
2 Corinthians 12:10: "That is why, for Christ's sake, I delight in weaknesses, in insults, in hardships, in persecutions, in difficulties. For when I am weak, then I am strong."
Scriptural justification that it might not be God's will to heal us, then are we obeying this Scripture passage? In other words, are we boasting about our sicknesses and delighting in them? Usually we go to a doctor, or we take medication, or we try to do something to get well, but notice that Paul did none of these things concerning his "thorn." Instead, he delighted in his weaknesses.
Paul did not ask God to heal him, but instead Paul asked God to take away (aphistemi, literally, "that it might depart from me") the "thorn." There's a big difference.