If you're looking for an electrolyte to improve the conductivity of water that you're electrolyzing, than yes, magnesium sulfate is a pretty good choice, and will speed gas generation. Neither ion -- Mg, nor SO4, is going to be electrolyzed instead of water, unlike for some other cheap, common salts, for example, table salt.