It used to be fairly simple because mobile phone numbers were stuck to their prefixes, however these days, portability is an issue that you have to come.
The only way to guarantee that you find the correct home network of the mobile phone is to do a HLR(Home Location Register) lookup. There are a number of sites that will allow you to test their system for home networks, however they are limited to the number of requests per ip in general, to stop abuse, and force you to pay for using their service.
I suggest you use the good old
Google and shop around for the cheapest. remember you will only need to do 1 lookup per number in reality per every 2 months say, to ensure that the network it is with is current. You could even get your clients to go to a HLR site and look up the network for you, thereby reducing the number of requests from your IP to 0, and still maintaining the numbers. It will be a hassle for your client to do, but for free sms messages, it will be worth their two minutes time.
Once a number has been entered into your site with a network, you could save that information for the next time the user accesses the site
All just idea's you will have to work around if you want to make it as free as possible
Jay