There are a lot of different kinds of folding beds. Are you asking about a bed with a two-piece folding mattress, a pull-out sofa bed, or a jack-knife sofa?
I've found the first only moderately comfortable, not because they fold but because it is a high density ("memory") foam construction, and my body prefers a mattress with a lot less give, like a firm innerspring with no topper or a pad on the floor. But a lot of other people prefer softer and put foam pads on top of even soft mattresses.
Pull-out sofa beds? I've slept on some really good ones and some really bad ones. It all depends on the quality of the mattress and the underlying spring structure. Mattress too soft, and I might feel the crossbars in the bed frame. Springs too giving, and the sag hurts my back.
Similarly for jack-knifes, there are good ones and bad ones. The one in my motorhome, the cushions are good enough, but proportions of seat and back are not equal and there is a crack to fall into. Bridging it with a foam topper makes it too soft for me. But I've slept on jack-knife folders on cruise ships that were just fine for me.