The first thing you should do is to report it to a trusted adult or authority figure whether that be their or your parents, or the school counselor/resource officer.
However, after you do that, you can try to care for them and comfort them as much as you can. It is recommended that you don't give them overbearing care as that can cause them to feel worse about themselves. If they do begin to hurt themselves, tell an adult.
Here is the National Suicide Prevention Lifeline: 1-800-273-8255