I can see that you're unable to use the keyboard on your iPhone 4S to send text messages. I know how important the keyboard is especially for the Messages app so I don't blame you for reaching out for help. Just to be sure I understand correctly, when you say it 'doesn't recognize the keyboard' is your display unresponsive? If your display is working normally, could you please provide me with more details of what you're experiencing? Additionally, what happens if you force close the Messages app or restart your device?
Use these links for help with forcing the apps to close and restarting.
How to force an app to close on your iPhone, iPad, or iPod touch
Restart your iPhone, iPad, or iPod touch
Let me know if this helps.
Thanks for using Apple Support Communities.