How to Turn Off an iPhone When It Is Frozen

If your iPhone screen is frozen or unresponsive, resetting the device is a surefire way to resolve the problem. Force resetting your iPhone clears the device's memory similar to the way that rebooting your computer resets your computer's memory. Resetting your iPhone shuts down your device and then automatically restarts it. Initiate the procedure by holding down specific buttons on the phone.

...
Force shut down and reset if the touch screen becomes unresponsive.

Step

Push down the "Sleep/Wake" button along the upper-right edge of the iPhone and the "Home" button below the device's touch screen at the same time.

Step

Hold both buttons down for at least 10 seconds or until the screen goes blank and the device turns off.

Step

Release the buttons you are holding down. The iPhone restarts automatically.