Foam is an insulator...it will not transmit the heat.
Add an electric blanket or mattress pad to substitute for the heated mattress.
They work well, are infinitely adjustable, and in the case of the blanket, can be tossed off entirely if you're too warm in the middle of the night.
This ends the response to your actual question.
But wait, there's more...
The added thickness of the foam will prevent you from closing the roof without resorting to extraordinary measures. DO NOT SIT ON THE ROOF. The construction of the roof is VERY flimsy...tissue-paper-thin plastic coating over, at best 1/8" plywood, supported by toothpick structure. It feels strong but it's not.
Loosening the hold-down clamps risks allowing water to leak past the seals between the roof and the tub.
We have a topper on our king. I added super-heavy-duty D-Rings to the side of the roof right next to the lift poles. The "goop" you see around one screw is Gorilla glue. It bonds to metal and wood (particle board) and keeps the screws from vibrating/stripping out. For an idea of scale, those are #14 stainless screws about 1" long for maximum bond. They might penetrate thru the roof side a bit, but into dead space in front of the lift pole attachments where they do no damage to anything. I use a ratchet strap from the D-Ring to the trailer frame and gently, patiently pull down on the roof until the roof clamps can connect and close.
The good news is that, while it takes some effort to compress the stacked canvass (a little different each time), the blankets on the bed, the foam topper, and the mattress, once compressed, they to not continue to exert unrelenting force on the roof. When I release the hold-down clamps, the roof does not spring up under lots of pressure. It just sits there, kind of like a brand-new foam mattress compressed for shipment. Everything slowly expands, but once compressed, the pressure on the roof relaxes...and it's distributed over a wide area.
If you're not fond of your mattress, you can buy high-quality foam mattresses that are not as thick as the combined thickness of your factory "inner-spring" mattress and topper. They cost about $200 to $330 max. Whoever thought a 4" thick inner spring mattress was a good idea needs a slap upside the head.
Meanwhile, we tried a new mattress, and my wife actually preferred the original with the foam topper we already had. The new one is now safely stored.
P.S. We have solar and a single puny little group 24 battery. Since we are fully charged by dusk, and since we exclusively boondock, I installed a 400 watt inverter and use it to power my electric blanket to take the chill off the bed. It can't run all night, because it draws 30 amps at 12 volts (as do the heated beds), but it only takes 15 or 20 minutes to warm the bed, then I shut it off. The furnace keeps us warm, and unlike an heated bed/electric blanket, the furnace prevents condensation inside the "tent."
End of unsolicited rant.