To setup a passcode on the iPhone, go to Settings application on the phone, and press the Touch ID & Passcode link to turn on the Passcode option. The exact method to set up an iPhone passcode depends on the IOS version installed on the phone.
You can use this exact procedure if you have IOS 8 installed on your phone. Once you access the passcode settings and turn on the Passcode option, the screen displays various options for you to browse. You can create a simple passcode such as a four-digit code used to unlock the device screen. There is also a phrase option where you can use letters and numbers as a password to unlock your iPhone.
If you have an iPhone 5s or a higher model, you can set up Touch ID as a passcode to unlock the device with just your finger. Your selection activates the phone’s passcode. Once you select the option, anyone that uses your phone needs your unique passcode to unlock the phone. You can change the option or deactivate it at any time.
Older IOS versions use a similar procedure, but the names for the links to get to the passcode settings may be different.