St. John says in his first letter that you should not pray for mortal sins.
“If anyone sees his brother committing a sin not leading to death, he shall ask, and God will give him life—to those who commit sins that do not lead to death. There is sin that leads to death; I do not say that one should pray for that” (1 John 5.16).
If you should not pray for a person who has committed mortal sin, how can the priest forgive this person? Doesn’t the priest have to pray in some way for the person?
“And the prayer of faith will save the one who is sick, and the Lord will raise him up. And if he has committed sins, he will be forgiven. Therefore, confess your sins to one another and pray for one another, that you may be healed” (James 5.15-16).
Unless praying for one another in James refers more to the healing of the physical sickness.