Foam on plywood may mildew as the foam can not breathe well - (how much you sweat plays a role in this).
My bed surface is 4" slats spaced bout 4"s apart, I think 2" spacing would be better. A dense foam mattress which seems perfect while on the living room floor is not thick enough when on the slats because the foam is not well supported. Breathes good though
If you go with a jacknife design that folds into a couch I would think that unless you go with a 2 piece mattress you will not want to exceed 6" thickness.
If you have a really dense foam then even 6" would be too thick to conform well.