To protect of your data in case your iPhone falls into the wrong hands screen appears, insert the passcode. If set properly, you must enter the iPhone passcode before the iPhone can be used.
Follow below steps to set an iPhone password / passcode.
1. Touch Settings -> General -> Passcode Lock
2. Enter a four-digit passcode
3. Re-enter the passcode for verification
4. Choose a time interval under Require Passcode
5. Select ON or OFF for the Voice Dial and Erase Data options
The shorter the require passcode time interval, is the more secure your iPhone be. Longer times mean longer spans unauthorized access can be.
Voice dial could be used without password while ON by holding down the home button.
By the way, if you forgot your iPhone password, you can read how to recover lost iPhone password. If you want to chang it, read how to change iPhone root Password.