The role of magnesium acetate is to initiate osmotic shock, and harvest macromolecules from the periplasmic space. The process involves extraction of periplasmic proteins using cold osmotic shock with magnesium, prior to sonication and ultracentrifugation to separate the cytoplasm from insoluble material. The periplasmic extraction is the most critical step since disruption of the inner membrane results in contamination from cytoplasmic proteins.
The common methods that are used are either an EDTA-lysozyme strategy or cold osmotic shock, or a combination of both. In the former method, EDTA is used to destabilize the outer membrane, allowing the lysozyme to enter the periplasm and hydrolyze the peptidoglycan cell wall. This process subsequently releases the periplasm and leaves the cells as spheroplasts.
The second method generates an osmotic shock induced by successively adding a hypertonic solution to weaken the outer membrane, followed by a hypotonic solution to partially disrupt the outer membrane without compromising the integrity of the inner membrane.
You may want to refer to the attached paper below which provides a robust method to isolate proteins from subcellular locations from Escherichia coli. The periplasmic, cytoplasmic and membrane fractions are separated without cross-contamination. Subcellular fractionation begins with extracting the periplasm, then the cytoplasm and finally the insoluble fraction that includes membranes and aggregated proteins.