A couple of weeks ago, someone opined to me that there was a type of person who was just able to sit down and play at the piano, without sheet music.
I, myself, am capable of playing precisely one piece inexpertly, from memory, at the piano. (My rendering of that piece is nowhere near the arranger’s standard.) I can play nothing else without sheet music. I very much think that this is the natural state for essentially every musician who has not spent thousands upon thousands of hours practising in a general way. That is, almost no-one can naturally sit down and play a piece from memory without a lot of work beforehand, and almost no-one can improvise well without a great deal of effort directed either at learning how to improvise, or at learning generally the mechanics of playing.
How technical practice helps
The syllabus for ABRSM exams contains a large body of scale-work, arpeggios and related patterns. There is a reason these are so heavily featured that one cannot attain a Distinction grade without them: because while they may not help much in learning pieces up to Grade 8, they really are useful beyond then. Someone who can sit down in front of an unseen piece and note automatically that “the left-hand is an Alberti bass in F#-major” is at a distinct advantage compared to someone who has never practised F#-major arpeggios, because the latter person has to read each note in both hands; the former can concentrate almost solely on the right hand’s melody line. An impossible piece can become quite do-able if you can reduce the left-hand’s job to that of repeating a memorised action.
How general performance practice helps
Because the same patterns occur so often in music, there is essentially no upper limit on how many useful actions there are to memorise. Most phrases of music end in one of a couple of recognised ways (cadences), and a given cadence doesn’t vary that much in its presentation. Someone well-practised could quite conceivably only need to read three-quarters of a piece, knowing that the remaining quarter is already-familiar cadences.
And, of course, it is hard to practise actual pieces without coming across cadences - they show up so regularly. By just performing general practice of a wide range of pieces, you naturally come to be able to play cadences without much thought. If you devote effort to learning particular chordal patterns, this process becomes even easier.
If you play the piano with any level of seriousness, you have probably played a fugue at some point. A fugue is a piece of music mainly characterised by a single melody which is repeated at various pitches, and around which a richly textured harmony is built. The idea is to bat this theme between several ‘voices’ (for instance, a fugue might have four voices, two played in the left hand and two in the right, analogously to a four-part choir), with each voice either playing the theme or embellishing upon it. It’s kind of like a more complicated and interesting canon. The key point is that fugues are all very similar in style, and if you have the skill of playing a single tune more than once simultaneously, in different voices and offset from each other, then you can pretty much play a fugue. That skill comes with practice.
Anyone who has sat a music exam knows how important it is to be able to recover from mistakes. The best way to recover from a mistake would be to improvise something that sounds plausible (ideally the original piece!) until you picked up the thread again. This, too, comes with practice: I have noticed myself that I have over time got substantially better at ignoring mistakes I make during a performance. Every so often, if I’m caught out while playing a piece I know well, I can just about invent a semi-plausible bar to fill in the gap before I recover. (If nothing else, I might be able to play the right chords in an unexpected inversion or something.) I understand that this skill has pretty much no upper bound.
The point is, then, that it is probable that sheer mind-numbing amounts of practice is what makes people able to sit down and play. Certainly some may require less practice than others, but anyone who can play at the drop of a hat has probably practised an awful lot to get like that. I certainly know of no counterexamples.