If you're sending an SMS that's longer than 160 characters, and you have the app set to not break up long messages, it sends them via MMS - which can fail on wifi. (Also, if you're attaching anything, or if you're sending an SMS to more than one person, and have it set to send group messages by MMS, the same thing can happen.)
(SMS is sent by the same path as voice, so whether you have a data connection or not doesn't matter for single-recipient messages of 160 characters or less. And, since most people now have unlimited texting, that wouldn't apply either.)
If you're getting the problem with an SMS sent to one recipient and it's shorter than 161 characters, talk to your carrier.