Self harm is supposed to be very bad, mainly because a person is deliberately injuring themselves due to a number of mental, emotional, psychological problems and/or substance. It can lead to things like severe scarring, infections, or accidental death. And yet many religions have at least some kind of self-harm as a ritual. Fasting, self-mutilation, self-flogging... I've even seen people on TV have themselves nailed to a crucifix. They would be taken down from it when the pain got too severe, which was usually in only a few minutes. Personally I think just having my palms impaled by big metal spikes would be too painful.
So why is self-harm bad when it's not done because of religion, but perfectly acceptable when it is? Deliberately torturing yourself should always be a bad thing.