First let me note that solitary confinement has historically been a part of torture protocols. It was well-documented in South Africa. It's been used to torture prisoners of war.Solitary Confinement: The Invisible Torture
There are a couple reasons why solitary confinement is typically used. One is that it's a very painful experience. People experience isolation panic. They have a difficult time psychologically coping with the experience of being completely alone.
In addition, solitary confinement imposes conditions of social and perceptual stimulus deprivation. Often it's the deprivation of activity, the deprivation of cognitive stimulation, that some people find to be painful and frightening.
Some of them lose their grasp of their identity. Who we are, and how we function in the world around us, is very much nested in our relation to other people. Over a long period of time, solitary confinement undermines one's sense of self. It undermines your ability to register and regulate emotion. The appropriateness of what you're thinking and feeling is difficult to index, because we're so dependent on contact with others for that feedback. And for some people, it becomes a struggle to maintain sanity.
That leads to the other reason why solitary is so often a part of torture protocols. When people's sense of themselves is placed in jeopardy, they are more malleable and easily manipulated. In a certain sense, solitary confinement is thought to enhance the effectiveness of other torture techniques.