Technically, it will; provided that you plug in an USB to 30-pin cable bcz that's the plug you have in the iPhone 3gs.

However, iPad4's charger has a 2.1A (or even a bit higher) charging capacity whereas the iPhone needs only a more conservative 1.0A charging. I'm not totally sure if this 12W charger has a current limiting function, while charging. If not, it will charge your iPhone almost twice faster. The consequences may be that your iPhone will get warmer than it's usual while being charged by this 12W charger and the phone's internal battery may detoriate gradually because of this "heavier and faster" charging.