See these articles iCloud: Use iCloud Photo Library on your iOS device
Transfer photos and videos from your iPhone, iPad, or iPod touch - Apple Support
Turn on iCloud Photo Library:
- On your iPhone, iPad, or iPod touch, go to Settings > [your name] > iCloud > Photos, then turn on iCloud Photo Library. If you're using iOS 10.2 or earlier, go to Settings > iCloud > Photos.
- On your Mac, go to System Preferences > iCloud. Click the Options button next to Photos, then select iCloud Photo Library.
- On your Apple TV, go to Settings > Accounts > iCloud > iCloud Photo Library.
- On your PC, follow the steps to set up iCloud Photo Library.
If you've already synced photos to your iOS device from iTunes, and then you turn on iCloud Photo Library on your iOS device, you'll see a message that says "Photos and Videos Synced from iTunes will be Removed." The photos and videos that you synced from your computer will stay on your computer, but they're removed from your iOS device.
You can get these photos and videos back onto your iOS device by turning on iCloud Photo Library on your Mac or PC. When you do that, the photos from your computer upload to iCloud so that you can access them on all of your devices. After you turn on iCloud Photo Library, all photos are in iCloud and accessible from the Photos app on your Mac or a folder on your PC.