As long as your iPhone is plugged in, connected to WiFi, and you've enabled the contacts option in the iCloud backup settings, iCloud will back up your contacts.