Re-mounting electrical switch box between studs after removing plaster and lath
The common method for dealing with this situation is to cut a piece of material that is nominally the same type of material as the studs and nail it between the studs as blocking. The electrical box is in turn mounted to the added cross piece.

Here is a picture of what one such blocking insert looks like (also known as header or noggin).