First of all, the balance is queried via USSD, not SMS.
Try these modem commands:
To query your prepaid balance on a GSM modem, you first need to enable USSD responses by issuing the following command in a terminal session to the modem: AT+CUSD=1<CR>
NB. The above is crucial otherwise your device will not interpret any USSD response received from the network.
Save this to the NVRAM by typing: AT&W<CR>
You only have to do AT+CUSD=1 once, and the config is saved after AT&W
Then type: ATD*141#<CR>
Sample response should be:
OK
+CUSD: 2,"Y'ello, You have R105.81 airtime. You are on MTN PAYG-Classic. Brought to you by MTN.",0
Note that USSD must be supported on your GSM device for this to work.