You can't. You can try to turn on airplane mode if the text has been sent, but the bar isn't fully complete, and then turn off the phone as a safety measure.
Unless it's stuck. If there's a photo with the text and it stops while sending, you can press on the message, choose "more" and delete. But if it completes the sending, it's gone.