More gender bias

Is sunnat something that the prophet did out of his free will?

Was it performed in adulthood or childhood? And was it a general practice at that time anyways?