Go to Settings > Touch ID & Passcode (on devices with Touch ID) or Settings > Passcode (on other devices) and tap Turn Passcode On. The screen will then prompt you to set up your passcode.
Go to Settings > Touch ID & Passcode (on devices with Touch ID) or Settings > Passcode (on other devices) and tap Turn Passcode On. The screen will then prompt you to set up your passcode.