IMessage randomly switched to text message?

I was trying to text my friend through iMessage (we both have iPhones and have always used iMessage before) but then I tried to send a message but it got stuck and didn't send the message. So I tried again and it sent it as a text message. It still says text message in the typing area, and it's so weird because iMessage is on in my settings, and it still says iMessage for all my other friends with iPhones. What happened and how can I change it back to iMessage?

Tell your friend to make sure imessage is on and make sure you both are signed into itunes