Grounding two boards connected to a backplane
This is not a great situation because in any of these three cases there will be a potential issue:


Ground loop. If there is any differential between the ground of one card to the other at the backplane (connector resistance, trace resistance, especially with large static or dynamic current) you will get current flow through the data connector grounds.
Forcing the ground path through the backplane. This is a good way to induce magnetic emission because that is based on the loop area.
Same issue as 2, but with less immunity to external noise.


Any one of these might work fine, especially if you don't have to pass a compliance test (ie some one-off test gear) and don't need to worry too much about emissions in your setup.

A possible alternative would be to pass the power and data to PCB #2 via PCB #1. This would have the benefit of reducing loop areas and keeping potentials down.

Another alternative would be to isolate the SPI signal with a suitably-rated optocoupler, but that is pretty extreme.

Finally, you might turn it into a differential pair, which would have the benefit of reducing the dynamic current being transferred. This would make option 2 more reasonable.

Keep in mind that grounding and EMI/EMC is a complex issue, and a final solution will depend a lot on enclosures, cable routing, bypassing, and other factors.

Good luck!