iMessage uses the internet to send its messages rather than using the carriers SMS system. As a result, an internet connection is required to use iMessage to send text messages to other iPhones, iPods, and iPads running iOS 5.0 or later. Usually, iOS 5 will select the appropiate message delivery method depending if you are connected to the internet or not. If your iPhone uses iMessage you'll see that the conversation bubble will be blue, messages that aren't sent via iMessage will have a green conversation bubble.
Hope this helps.