Let's say if you're playing a song in C major and you move to D major: as an example, say the melody is 3 2 1 2 3 3 3 (these are scale numbers). Then you're using the thumb on 1, index on 2, and middle on 3 and so forth. So the same fingers hit the same relative notes throughout the song regardless of key. Therefore, when you learned a piece by heart it doesn't change much between keys because the fingers function the same. Does this sound right?
Funnily enough, I use the same fingers all the time. Mine! Of course the order in which they're used varies. Mainly because the patterns are all different. Black, white, gaps. An obvious starting point is C major scale. The fingering for that is probably the first most beginners learn.
Moving the thumb to get to the second part (from F) has to happen. Works the same for D, and E. But what about Eb? Bb? Use the same fingering and it's not as smooth. So start with a finger on the black key and it's easier to play smoothly.
Using the same principle, the sequence of notes in a tune in one key may be transferrable with the same fingering, but certainly won't always.
There's a certain naivety about this question that hints that you haven't actually tried out this theory, and if you had, the question wouldn't be here.
Edit: re-reading, for C and D, there's minimum change, in some tunes none, but extrapolating the idea out to other keys, it just doesn't, and can't make sense.
FINGERING can change from key to key. Even though you may use the same standard numbered fingering for keys such as C, D, E, G, A and B, there are hundreds of other adjustments within the arm that are (should) be happening based upon the black keys.
Since the C scale is all white keys, there is a lot of in and out motion you need to do to stay on the edge of the keys. However, when you play in D, for instance, you have more inward motion because the black keys are further in. Also, since they are higher, you need to lift or shape your arm so that you can come straight down onto the key instead of clawing your way up to it. Like walking up stairs, you lift your foot higher than the actual step then come straight down onto it. If you didn't, you'd trip, as most pianists do when trying to play "relaxed."
Also, since you now have to lift the arm higher you will have to adjust your pronator and supinator rotation to facilitate the thumb. Hopefully you were not taught to cross the thumb under the palm. If you were, find a new teacher and learn to play from the arm.
Since there may now be larger gaps between consecutive keys or fingers, and you may be lifting higher, you may need to increase your lateral arm movement to get the fingers where they need to be.
Proper fingering is good to work out grouping and rotations but once you have mastered a good ergonomic technique, you'll find yourself abandoning conventional fingerings at times. There are fingerings for arpeggios, for instance, where I used to use four fingers for but as I increasingly played from the arm, I reduced it to two fingers. Sometimes when I am playing out and feeling bored or frisky, I may introduce a melody using only my arm and pinky, or thumb, or ring. Just to work on forearm alignment or gravity.
They do change. Try the scale of C major with your right hand: C D E F G A B C. Now do the same with F major : F G A Bb C D E F, and with Eb major : Eb F G Ab Bb C D Eb.
You'll see that you'll have a hard time using the same fingering. One rule that you can apply consistantly is to avoid the thumb on black keys. This yields the "standard" fingerings 12312345 for C major, 12341234 for F major, and 31234123 for Eb major.
Actually, I found that practicing scales helps precisely with where to "pass the thumb below" the 3 or 4 depending on the key (for instance, in F major you should arrange for the 4 to be on the Bb to avoid problems, in Eb major targeting the 3 on Eb is also good, etc, this of course depends on context). For improvisation this is a good thing to know...