I have an ac circuit with 3 ground wires. This circuit switches between two ac power sources, accounting for two of the ground wires. The last ground wire comes from a switch. Is it safe to pigtail these ground wires together and connect them to a ground terminal on an electric receptacle?
Anytime a question comes over from electronics.se, we have to pause to get clear on terminology. In mains power, "Ground" is not GND/Vss/normal current return.
Mains power has "Ground" as the Equipment Safety Earthing. Only a horrible malfunction should cause current to flow, and then hopefully instead of through a human. That's important enough that it gets its own wire, and that wire is not used for anything else.
And then we follow through by actually spiking that into the earth, which also helps natural electricity (lightning, ESD) return to its natural source.
Your working conductors that are part of the circuit are obviously not ground. If one of them is intentionally designed to be near ground potential, it gets called "neutral".
When you are switching two separate power sources, you must switch all the working conductors, including neutral.
Now, there's one more thing. When neutral is intentionally rigged to be near ground potential, that's done by bonding in a very specific location, as close as possible to the source. The bonding is just a wire, nothing fancier than that. If you have two separate power sources, and both of them have a neutral-ground bond, and one of those neutral wires fails in the wrong location, then the current will return via a circuitous path through the other neutral-ground bond. Even if the wires don't have the capacity for that much current - traditionally neutrals are not fused, and grounds shouldn't be fused. This is Rather Bad, and it's why having two neutral-ground bonds in a system is super dangerous. So you need to select your sources with care.