There are plenty of webservices that have programmable API that could send text messages. They often are language independent. Can't really suggest any specific API, as I don't really want to promote the one I am using at the moment (not bad, but nothing special). If you google "SMS API" or something similar you should find enough results and documentation to pick the one that fits your needs.
If you don't want to use these services, then you need to physically attach a phone (or a device that works as a phone), and build a little program that would interface with it.
I would strongly suggest you to use the first method.