Scales carry a strong association for adults, and it is usually somebody else's childhood: a required exercise, done under supervision, for reasons never explained. Plenty of people who quit the piano at twelve remember scales as the reason.
So I want to avoid the two standard arguments, because I do not find either convincing. Scales are not valuable because they build discipline, and they are not valuable because they strengthen fingers — piano playing does not need finger strength, and a scale played badly builds a bad habit as efficiently as a piece does.
Here is what they actually do.
Three things a scale teaches better than a piece does
1. The thumb passing under, in isolation. This is the real one. Every piece that moves beyond five notes requires the hand to change position, and the mechanism is the thumb traveling under the hand while the hand stays quiet and level. Done well it is inaudible. Done badly, the wrist jerks and there is a bump in the line — and that bump then appears in every piece you play, for years, uncorrected.
A scale is the cleanest available place to practice that one movement, repeatedly, without anything else competing for your attention.
2. Evenness you can actually hear. In a piece, unevenness hides inside the music. In a scale, every note is the same length and the same weight by definition, so any lump stands out immediately. It is a measuring instrument for your own hand — and the notes that come out uneven will be the fourth and fifth fingers, for everybody, which tells you where the work is.
3. The keyboard stops being a wall of white keys. After a few scales, you begin to see the instrument as patterns and groups rather than as eighty-eight identical things. That makes reading faster, finding notes faster, and transposing possible at all.
Notice that none of those three is "speed". Playing scales fast is a consequence of playing them well, and pursuing it directly produces a fast, uneven scale, which is worth nothing.
When to start
Not in the first weeks, and this matters. In your first weeks your hand is learning to make one good sound, sit properly and stay loose. A scale before that is a thumb-under drill performed by a hand that has no technique to carry it, which is how the bump gets learned in the first place.
Start once both hands are working, once you can play a few pieces that use a full five-finger position, and once you are meeting passages that go beyond where your hand comfortably reaches. In other words, start them when a piece has just shown you why you need one. That timing turns a scale from an arbitrary exercise into an obvious tool, which changes how it feels to practice.
How to practice one so that it does anything
Hands separately, for a long time. Hands together on a scale is a coordination exercise on top of a technique exercise, and it hides everything you were trying to observe.
Slowly enough to hear each note end. If the notes are running into each other, you are too fast to notice the thing you are practicing.
Watch the wrist at the crossing, not the fingers. Your eye should be on the place where the thumb goes under. The hand should not rotate, the wrist should not jerk sideways, and the elbow should drift gently along with the hand rather than staying pinned to your side.
One octave is enough for months. Two octaves of the same fault is not better practice than one.
Five minutes, not twenty. This is a precision exercise, and attention is the limiting resource. Twenty minutes of scales in a thirty-minute session is a poor trade against the pieces you are actually learning.
When scales are the wrong thing entirely
If you have twenty minutes a day, and you are three months in, and a scale would take a quarter of your session, and you would rather quit than do it — then do not do it. An adult who plays pieces every day for a year will pass an adult who does scales resentfully for a month and then stops playing altogether.
That trade is real and it is worth being honest about. The value of scales is genuine but moderate; the value of still playing in a year is everything.
There is also a middle path most people never hear about: take the scale-shaped passage out of the piece you are learning and practice that. It teaches the same thumb crossing, in the context where you will need it, and it does not feel like homework.
What about all the keys
Later, and not out of completeness. Learn the scales that the music you are playing uses. When a piece is in G, learn G. The set of all twelve is a project for somebody preparing for examinations, not a requirement for an adult who wants to play.
The part you cannot see
The thumb crossing is the clearest example in the whole instrument of something invisible to the player and obvious to a watcher. From where you sit, your hand is behind your own attention; from the side, the jerk at the crossing is unmistakable.
So put the phone at the side of the keyboard, at about the height of the keys, play one octave of a scale slowly with one hand, and send it. The written feedback is free, and this is the single thing it is most useful for early on — because the fault is small, specific, fixable, and completely hidden from the person making it.