What do you call this sitting pose or position that sad or depressed people adopt?

Yes, in idiomatic American English, at least, "hugging one's knees" is exactly the phase to use to convey the pose your describe. However, "hugging the knees of sadness" is not used.

Your example:

Why are you sitting in the corner hugging your knees like that? Has the world come to an end? Come on, pull yourself together!

If you don't need to specific about the pose, you could use "moping", and readers might picture the right pose, anyway.

Why are you sitting in the corner, moping like that? Has the world come to an end? ....

But this isn't always the right word.

Captions to your example pics might be:

  • "Overcome by the utter humiliation he'd suffered, Kevin hid behind the wall, hugging his knees, and crying."

  • "Sure that his parents would never understand, Steve sat on the floor next to his bed, hugging his knees and wondering how he could tell them the truth."

  • "Bored, and a little melancholy, Susan sat on the bench and hugged her knees, head to the side, watching all the happy, purposeful, people walk by."

Note that sadness is not a requirement of the pose or the phrase:

  • "The children waited in the corner, bright-eyed but patient, hugging their knees and trembling, ready at a word to burst into joyful, excited movement."

Hunched, head tucked between the knees/legs. As far as I know, there really isn't a specific posture name in the general domain, though there may be a medical name as I believe it's a pose that helps in some circumstances.