Apparently David received an answer to his petition. It may have come through a prophet or just the inner conviction that he would recover. In any case he closed the psalm with a warning to his adversaries (v. 7) to get out of his way. He was on the mend and would frustrate their attempts to supplant him. Jesus may have quoted the first part of this verse to Satan (Matt. 7:23).
Physical sickness is sometimes, but not always, chastening from the Lord (cf. 1 Cor. 11:30; 1 John 5:16; Job 1-2). God does not always grant recovery to His saints. Consequently believers should not use this psalm to claim physical healing from the Lord. Nevertheless sometimes God does remove His hand of chastening in response to prayer (cf. Exod. 32:9-14; James 5:13-16). This psalm is a good example of a prayer for deliverance based on the grace (v. 2), loyal love (v. 4), and glory (v. 5) of God. God will or will not grant all such petitions ultimately on the basis of His sovereign will (Mark 14:36).