Connecting Two Grounds Together
Just think of connecting several batteries together. Each battery is floating if not connected. You may connect the minus point of several batteries to the same ground, you may have different strings of batteries connected in series.
If you know for sure that the 5 V supply is floating, you may connect both minus points together regardless if the 12 V supply is grounded or not. You may use a multimeter to measure the resistance between the ground connection of the AC plug and the minus output of the 12 V supply. Please be sure to measure at the ground connection only, not at the hot wire! If the other power supply is really floating, you should measure a high resistance there.