I will tell you from my experience even though I haven't cut myself. I feel like it's a kind of release from all the stress, anxiety and all the other things that's causing the agony. When certain things trigger you to put you in a state where you think nothing makes you happy, nothing good is gonna happen, nothing can inspire you, nothing is worth enough to put some effort on and then feel like shit for feeling so, you're in a vicious circle of these bad emotions.
And at some point, it gets too much that you want a release. It's not easy to talk about it to others either (at least for me). When that point is reached that you require to be freed, you choose an escape mechanism. I believe it'd be different for different people. It could be something very dangerous or something that's not. But I believe cutting/bruising/scaring themselves is such a kind of escape mechanism. It is important that you talk to them. I wouldn't say that making them talk about the issue will be the first thing I'd do. It's important first to create a safe space for them to get comfortable and share first. And it's also important to affirm them that their feelings are heard and it's valued. And then see how serious the issue is and decide whether or not to seek professional help.