If you walk into a classroom of kids, mostly likely you'll hear a teacher telling all the kids to sit up straight whether it's in orchestra, the classroom, or an assembly. What the kids then do is stick out their chest out and attempt to look like a gymnast popping off of the high vault. The name spinal column leads many folks (of all ages) to believe that sitting up straight is the solution, when in fact the undulating curves of the spine are what help us move in so many diverse ways. Many sitting commands don't acknowledge these curvatures (including the yoga tadasana cue "tuck your tail," which can flatten out the low back curve). The spine is in no way straight like an architectural column, and sitting up straight can be a confusing cue when we don't have a rod for a spine.
As a baby, our spine starts as one giant C curve in order to accommodate the small space of the womb. Learning how to sit upright and support the neck's weight starts to develop the curvature of the cervical spine, which starts around 4 months of age and continues through months nine and ten. Learning how to walk (after crawling) will help develop a lumbar curve, and movements from 2-10 will solidifiy the curvature of the spine. Clearly, the spine is a fluid series of curves which develops throughout childhood. When most kids interpret the words "sit up straight," they over correct and attempt to flatten out the curves of the spine. Many adults continue to react to this cue, long after they've left the classroom, which can lead to some interesting postural, performance, and sometimes pain patterns. What we can do instead is (with the help of movement and manual therapists) start to sit better, or in balance, or in alignment, or in any other word than straight. In addition, it's ok to move through different positions while sitting (including slouching), because sitting in the same position for hours and hours isn't great for your body. See if you can learn how to find a better way to sit allowing the natural curves of the spine to do their thing, while also allowing for some variation in your sitting positions. Sitting alignment is a complicated thing, but I think we should retire the command, "sit up straight."
If we look at this image, it looks like the "good" boy has no spinal curves and is sitting up in a way that presses his whole back to the chair.