May 2017 Update, Fix, Solution,: This started happening to me recently where iMessage on MacBook Pro and iMac wouldn't send unless the contact had iMessage and won't send to the mobile number.
After reading all answers about turning iMessage on and off and reactivating forwarding to and from the device and changing the Apple ID password it STILL didn't work.
What I have discovered is that this was ONLY doing this to the numbers in my contacts that didn't have the correct country code in front of them ie. 0400 400 450 didn't send in iMessage but as soon as I changed it to +61 400 400 450 (for example), it worked perfectly.
I've just gone into my contact list (which I share also via iCloud through all my devices and my iMessage is working perfectly now for all my contacts. I wish I had known this sooner rather than wasting over 2 days on this problem. I only discovered the solution by accident because the messages that weren't going through were the ones that didn't have the country code in front of them.
Thankfully fixed now. Found it easier to log into iCloud and update all my numbers from there 😉