Is it safe to turn on passcode on my old iPhone 4S, or is it going to block itself?

I'm afraid that, because it is an old device, it will eventually block itself and I wouldn't be able to access my datas.

That's not how iPhones work, the only way it will block itself is if you enter the passcode wrong too many times. Doesn't matter how old the device is, the passcode will always work the same as a new device.