There are quite a few different SMS providers which have Java API's for you to use. I guess price etc will depend on which country you are using them from. If you Google the search I'm sure you will find plenty of examples as each provider can be different. One example is a company called TextAnywhere.
If you are asking how they work I'm afraid I don't know enough to answer that in detail.
But they basically allow you to send SMS messages just like you would through your mobile phone to another number.
If you are asking why they are used I guess there a million reasons for their use. If you have a critical threshold on a system instead of writing to a log file you raise an alert that sends the SMS to a number of admins who can prevent something from getting worse or you can have a website that takes in a customers number and texts them to keep them updated on their order etc.