Many moons ago while I was in University, I manufactured and sold terrain for use in Wargames rto make a bit of money. I tried many different methods to seal various polystyrene foams, most have been mentioned here. I settled on one of two methods.
1) For pieces that didn't need to have a super hard coat, I would spray a mixture of PVA and Water at around 50:50, tinted with artists acrylic paint.
2) For harder wearing pieces, I added powdered cement to the above, which created a very tough outer shell. This needs to be brush painted, for obvious reasons. Probably not suitable for most prop work as it creates a rough surface texture, but I mention it here as someone may have some use for it.
These days, I don's use much foam, but if I did I'd probably go with Gesso, or if I was in a hurry PVA/Acrylic paint mix through an airbrush.