Chris, if you are using foam moldings, they would be perfect for the job. I don’t think that I would use wood moldings in the tub/shower stall area. The wood would be subject to a lot of variations of heat and humidity and you would have a lot of wood movement with resulting cracks or gaps over time.
If you really feel that you have to do this with wood moldings, prime and paint them front and back before installation. Ask your paint store to put extra mildewcide in the paint unless the paint you buy is specific to bathrooms. If the paint store you visit doesn’t know what you are talking about or says that it can not be done, go to another paint store and look for either a local store specializing in paint or a store of one of the major paint manufacturers like Sherwin-Williams.
Henry in MI