An SMS gateway is a service that makes it possible to send and receive SMS text messages through a REST API (like an SMS API). This is the “bridge” between the code you write in your web application and the global telecommunications network that delivers it to a recipient’s mobile phone.
The SMS gateway is also what translates the message so it’s compatible with the carrier network.
They usually route SMS text messages to the telco networks via an SMPP interface that networks expose, either directly or via an aggregator that sells messages to multiple networks.
See more information on SMS gateways