I think the word IF in
James 5:15 would inticate that at times the sickness is BECAUSE of SIN.
Not every time, but some of the time.
Also verse 16 tells us (the Church)
how to get healed.
James 5:14-16
14 Is any sick among you? let him call for the elders of the church; and let them pray over him, anointing him with oil in the name of the Lord:
15 And the prayer of faith shall save the sick, and the Lord shall raise him up; and
if he have committed sins, they shall be forgiven him.
16 Confess your faults one to another, and pray one for another, that ye may be healed. The effectual fervent prayer of a righteous man availeth much.
KJV