When you have an iPhone 4s, does iCloud automatically back things up?

Or did you have to turn it on before it could back anything up?
I just lost everything on my phone and I'm trying to restore it from my iCloud but I don't know if it will work since I never looked into iCloud.
Does it work automatically?

Yes, if you enable iCloud backups when you first set up the phone, then backups will be made when the device is plugged in and locked.

You have to turn it on first.

Yes, if you set up on your iPhone first, it will automatically backup.