If it's the button you have to change it's possible. But when the powerbutton doesn't work it's most likely the power flex cable thats broken. That one also includes light sensor and the speaker near the headphone jack.
The iPhone 4 and 4S have different connection point on the motherboard And the iPhone 4S is longer and goes "around" the speaker. They are made entirely unlike. So I it's not possible to use a 4S power flexcable on a iPhone 4...