Imported from the Apple Support Forums via the Wayback Machine 🔗
Hello.
You can transfer your contacts by restoring a backup from a previous phone on a new one.
But if you don't want to, then go to your previous phone, head to Settings > Your Name > iCloud, make sure you turned on the toggle for Contacts, complete an iCloud Backup.
Turn on the Contacts' toggle on a new phone and it should download them from the cloud on to your new iPhone.