Before you store the sails, hoist them slowly, giving them a fresh water
"bath" on each side. This is to remove salt
and dirt. Let them dry. Then fold, bag, and store.
Honestly, I don't think you can totally avoid mildew, but it is great if you can discourage it happening. You don't give us an idea of your location, and the aggressiveness of mildew is greater in areas that have high humidity all year around. If you are in one of them, once the sails are clean, air each of them once a month. All that should help.
If the sails are folded on a dock
or a lawn, you can usually get them pretty tidy. Get someone to show you how if you are unfamiliar with doing it.