You need to make sure that the low levels are correct too.
simulate this circuit – Schematic created using CircuitLab
Figure 1. A connection (shown in green) is required between the GND of each circuit to give a common reference for signals passed between them.
Note that while the power supply negatives are directly connected to each other through the ground circuit that there is no direct connection between the supply positives. Therefore there is no risk of high voltages or currents between the two devices.
If your logic levels are the same (3.3 V or 5 V) on the out and in ports there should be no problem with this arrangement. The common ground gives a common voltage reference for the signal being transferred. Assuming a 5 V system, when OUT switches high there will be 5 V between OUT and GND and there will be 5 V between in and ground. As mentioned at the top, when OUT switches low there will be 0 V (or close to) on OUT and 0 V on IN. All will be well.