Most SMS providers allow you to respond with STOP to indicate that you no longer want to receive SMS messages. If we try to send another message to a phone number that has replied with STOP, it won't go out.
However, it's not clear how this information gets back to CiviCRM, if at all. Does this have to be handled on a per SMS provider basis? Or should we be building a more generic framework to support all SMS providers? Or is there a way I haven't figured out?
For reference - here's how Twilio handles it: https://support.twilio.com/hc/en-us/articles/223134027-Twilio-support-for-opt-out-keywords-SMS-STOP-filtering-