As a few have pointed out MDF is not an ideal baseboard material but having once spent a few years operating a press that makes the stuff and lab testing it I can share a few pointers.
The key flaw with MDF which can be seen in it's cross section is you have two high density surfaces laminated by a low density core, the thicker the board the more core you have so the surfaces flex further; the framework needed to adequately support your free 18mm MDF will probably cost more than starting from scratch with a conventional plywood base.
Another issue is that while the surfaces are quite moisture resistant the core is very absorbent, so thicker board will be more prone to swelling along the edges; it needs to be sealed with paint or varnish.
Most importantly, SAFETY FIRST, wear a dust mask when cutting MDF, the dust is very nasty - looks like broken glass under a microscope and depending where in the world and when it was made the resin used can be potentially carcinogenic.
It's not all bad though, I like the crisp grainless finish of MDF, but I wouldn't bother using anything thicker than 6mm, it won't be more rigid, just heavier.... Ok, maybe 9mm if it's free.
For modules or a cameo layout box 6mm is ideal - more rigid than 12mm ply, although it'll probably weigh as much; 3mm is great for back scenes and layout edges - apply a some heat if you need to bend it and it will hold it's shape when cooled.
Be wary of free MDF, it'll probably be downgrade used as packing for the good stuff. Don't pass it up without checking though, it only might be downgraded for being out of spec for thickness or surface density. Leave any sheets with uneven or soft surfaces, swelling, or delamination (splits) at the edges.
Cheers,
Glenn.