Couple of points of information here. You have taken a pic. of a "panned joist bay". The tin you see is used to close the bottom of the joist bay, and create a return duct to the furnace. Plumbing and wiring are technically not acceptable in this space, for fire safety reasons. That said, it isn't the first time anybody panned a bay with other mechanicals in it, and I wouldn't worry about that issue. Second there is no "union" involved here. Unions are removable connections that are specifically designed to allow for disassembly of a mechanical connection, you don't have on in these pics. You are looking at a standard 90* ABS DWV fitting and perhaps a 22* fitting attached to it. ABS is the material, as opposed to PVC, DWV is the pipe designation, and it stands for drain, waste, vent. It can only be glued with an ABS specific glue, and it does not need a primer. I doubt that it is 4" pipe, probably 3" which would be 3-1/2" O.D.
This may be a pretty simple fix. you need to remove piece of the tin pan to access the area. It is probably nailed thoroughly, and excessively, with roofing nails into the bottom of the joists. You can repair the area using the same material and techniques. Tin, and metal foil duct tape are readily available at Home Depot. Once you access the pipe, you may encounter a glued joint or fitting that was originally assembled dry, as in the installer forgot to glue it. Twist and bang on everything. to see if anything is improperly assembled. The other thing to look out for is that some ABS pipe will fail with age, by splitting at the seams. This may be a bit tougher to spot, as it will be a nearly microscopic, but very straight clean split in the pipe, running the length. The cure for this can be as simple as wiping the area clean and using ABS glue as caulk. Good luck, nice sleuthing so far. BTW, A neighbor just ran into this exact issue when some of the 20 Y.O ABS drain lines started to split open at the joints. I don't know how prevalent of an issue it is? But it certainly is possible that this is your problem.