God allows pain of many different varieties for many different reasons. Spiritual growth, discipline, identification with the sufferings of others, preparation for ministry, chastening, and the understanding that this present world is not our truest home - are all included in our present experience of physical, emotional and spiritual discomfort.
Recently I have pondered another reason that has led to a rich and vivid devotional benefit in my walk with the Lord (I'm probably later to this understanding than most folks, as usual). Several months ago, I stumped my toe in the middle of the night. It hurt quite a bit, and as such things do when you're groggy and half asleep, it shocked me to my senses. As it did, somehow the remembrance of our Lord's sufferings came to mind. I recalled the Bible's teaching of how much pain He knew on the cross, and of the spiritual, emotional and physical agony He experienced in order to save us from our sins. In that sleepy moment, as illuminated, led and enabled by the Holy Spirit, I gave thanks for the Lord Jesus' willingness to suffer grievous torment and pain for me, and for all.
Since that time, I have had a number of experiences of pain in which the Holy Spirit has graciously brought to my attention the infinitely greater suffering of our Savior. He who is worthy of eternal and infinite bliss willingly embraced for us the agony of Calvary. Every pain of our own therefore becomes opportunity to acknowledge the grace of the Lord Jesus anew and afresh, and thus to grow in love for the One who so loves us. Saying "Thank You" doesn't seem enough, of course, and there's no way to adequately feel the appreciation our Savior so richly deserves. I suspect, however, that His heart is greatly blessed when our pains become the basis for worshipful remembrance of His pain. I also believe that a sanctifying effect takes place in our own hearts as gratitude fills and springs forth from our hearts.
Certainly our Heavenly Father takes no more pleasure in allowing or determining pain in our lives any more than we do in our own children. Suffering is necessary in our current existence, however, and our determination to avail ourselves of opportunities to trust and submit unto God in pain greatly benefits us and those to whom we are called to minister Christ. Even more, the choice to use our experiences of pain as opportunity to remember our Savior's sufferings doubtless blesses our Father's heart in a particularly sublime expression of loving devotion. For the trusting and devoted believer, there are few more blessed prospects.