can I use Two Same Power supply sharing input in single circuit?
You have identified one issue correctly: both need the same ground reference, tying the grounds together will do that.

The other issue is whether your circuitry will work if only one of the supplies is on.

In your case, if the controller is powered, pulls the base of the transistor high, but the supply on the collector is off, then the other circuit will be powered through the base-collector diode of the transistor, i.e. the relay gets 2.6V (3.3V minus Vf of that diode) from a microcontroller GPIO, and the internal resistance of the relay will not be high enough to limit the current to what is safe for the microcontroller.

So, if the top power supply fails, your microcontroller will be fried if it tries to pull the transistor base high.

The simple fix would be a current limiting resistor on the base (which needs to be large enough to keep the current below the maximum for the GPIO, yet small enough so the transistor can fully open; whether such a value exists depends on the  of the transistor and the design current through it).

A probably better fix would be to replace that BJT with a FET.

Side note: are you using that transistor to short 12V to ground to turn off the relay? You probably want that in-line with the relay, and protected with a flyback diode, and possibly also add a capacitor and current limiting resistor for the relay.