You must think electrically, without thinking first to the chemistry. In the anodic solution first, the reaction produces positive ions $\ce{Mg^2+}$ or $\ce{Zn^2+}$. It does not really matter here. The problem is that this cannot stay like this. Either the positive ions have to move where negative ions are available. Or new negative ions must arrive in the solution. Or both.
The simplest way for solving this difficulty is to mix the two solutions. Because a similar difficulty appears on the cathodic region : positive ions ($\ce{Ag+}$ or $\ce{Cu^2+}$) are here discharged, leaving an excess of positive ions around the cathode. By mixing the solutions the excess negative ions produced around the cathode move to the anode where they are needed. But mixing the solutions is the least thing to do, because now $\ce{Ag+}$ or $\ce{Cu^2+}$ ions can touch the $\ce{Zn}$ or $\ce{Mg}$ anode. And the chemical reaction will go on in the contact between positive ion and metal. The same electrons of the half-reaction are produced but they will not go through the long external circuit form the anode to the cathode. They prefer the shortest circuit direct from metal to ion in solution, and metallic $\ce{Ag}$ will soon be formed on the $\ce{Mg}$ anode (or $\ce{Cu}$ on the $\ce{Zn}$ plate). No current will be emitted in the outer circuit. It is the end of the cell. So it is absolutely necessary to prevent the $\ce{Cu^2+}$ or $\ce{Ag+}$ ions to touch the anode, so the two compartments must be separated.
That is why we introduce the salt bridge. It must contain ions that do not react with any ion contained in the two compartments. Their nature is not important. Usually it is $\ce{K+}$ and $\ce{NO3-}$.
So let's go back to what's happening electrically in solution when the cell is working. There is an excess of positive ions around the anode, and an excess of positive ions around the cathode. To compensate this situation, the negative ions of the bridge are attracted by the positive ions in excess at the anode, and the positive ions of the bridge are attracted by the cathode. Both quit the bridge and get mixed in the solutions. This allow the cell to work.
After some time, the bridge is loosing all its stuff, so some positive ions of the anode ($\ce{Zn^2+}$or $\ce{Mg^2+}$) may enter the bridge and replace the initial positive ions $\ce{K+}$that have moved to the cathode. And symmetrically some negative ions ($\ce{NO3-}$ or $\ce{SO4^2-}$) from the anode will enter the bridge to replace the initial ions $\ce{NO3-}$.