James 5 is a call to a relationship of deep intimacy and trust in the Almighty in every season of life. It is a call to approach God no matter what you are going through, whether it be good or bad, physical or spiritual.
He begins: “Is any one of you in trouble? He should pray.”
That phrase “in trouble” literally means “distressed.” Are you troubled? You should take your trouble to God. Prayer is, before it is anything else, intimacy with God. It is an invitation to invite God into your circumstances and to trust Him in those circumstances. Prayer is not a duty. It's a delight and a gift for the people of God to commune with their adopting, loving, merciful, Heavenly Father.