A gateway in the broadest sense is basically something which connects two entities which function differently. SMS gateway is something which acts as a connecting point or a relay to facilitate transfer of messages between the SMSCs (Short Message Service Center) of different communication providers employing different protocols.
But recently SMS gateways are in use not only by cellular providers but also by SMS marketing companies and SMS application developers. Suppose you want to develop a bulk SMS messaging application and for that you have your SMS server configured to send and receive messages.
But there is a problem, in order to incorporate different providers using different protocols your server will have to connect to all their respective SMSCs making your application code more complex as it has to support all their respective protocols too. One feasible option is to use SMS gateway software which will connect your SMS server and the various SMSCs. So now the SMS server has to be configured only for the SMS gateway and the SMS gateway handles all the SMSCs, making your application more reliable and simple.
An SMS gateway is also used at places where instead of a direct connection to the SMSC you prefer to use a GSM modem or a GPRS modem for your messaging application. Along with bulk SMS applications, email to SMS applications also has use for SMS gateways. If you want to build such applications there are a lot of SMS gateway providers are available online. Luckily even free open source SMS gateway software is available on many websites. Here are some of the links to download SMS gateway.