Well, first let me discuss whether or not this is feasible.
As far as I know, the Gen3 and Gen4 slides are not interchangeable. The full-size and compact Gen4s use a new/different recoil spring assembly (RSA), which means the slide, barrel and frame have different size cutouts for the RSA. I have heard about an adapter for the Gen4 models which will allow the Gen3 spring to be used, but I'm not sure this will address all the potential problems with other parts like locking blocks and barrel locking ramps, etc. If you have any solid info/links on folks successfully doing this type of conversion, I'd be interested in reading about it.
Now, the legality. I'm not a lawyer, nor do I play one on TV, and I didn't even stay in a Holiday Inn Express last night, so take this for what it's worth. If you own both pistols, and if the slides will safely work on both frames (see above), then I can't see how a temporary swap could cause any legal issues. If you wanted to sell one of the converted pistols, THEN you might run into a problem with changing the markings on a pistol (the Gen4 designation on the slide might be considered part of the legal marking on the pistol, and defacing/removing/changing markings might be considered a crime under Federal law). Is a Gen3 with a Gen4-marked slide, a Gen3 or a Gen4 pistol?
Anyone else who has something that I might have missed, jump in.