There is only so much power available on the the USB Bus to power Devices, An iphone needs a decent amount of power to charge and some of that power is already being used to power the keyboard. so it is requesting more power from the bus then the bus can provide.
Also on your MacBook Pro all USB ports aren't created equal, depending upon the port you use, it may have less power available since it is being shared with some internal USB devices (such as the webcam and SD card reader).
To find out which ports are being shared with which devices, plug in a known USB device and open System Information (System Profiler on older versions of OS X). In Hardware > USB, find the known device in the USB Device Tree. Check whether there are other devices sharing the same USB High-speed Bus. If the port in question is being shared, you might try charging on a different port.
Also take a look at Apple Menu -> about this mac -> more info -> system report
Look at the usb info, it will show you how much power is provided / available.
If you want to plug the iphone into the keyboard and the keyboard doesn't have enough power or the hub in it isn't powered, you will need to purchase a powered USB hub, and then plug that in. The powered hub will have a wall wart that provides power via the usb ports.