I do not know all legal aspects, and suppose that the other answers are correct: this is decided by the owner, not by the editors. But this frequently happened with the journals I collaborated with. For example, Computational Methods and Function theory was published by a small independent publisher, and then they moved to Springer. I was on the editorial board, but they never asked my opinion, just informed me about the fact. I resigned.

Acta Mathematica once also moved to Springer. I was considering withdrawing my accepted paper, but did not: it was already too late. I think that since then they moved back.

Journal d'Analyse moved to Springer at some time, but they explained that Springer only does distribution, not actual publishing (I do not know all legal details).

Journal "Mathematical Physics, Analysis and Geometry", where I was on the editorial board, started with Elsevier, ignoring my objections. Few years later they discovered that I was right and decided to move away from Elsevier. Elsevier had some legal objections. The result was the split into two journals: one under the old name published by Elsevier, and a new one which changed the name to "Journal of Mathematical physics, Analysis and Geometry". The editorial board also split into two disjoint subsets.