What are the rules for praying with the spouse? Does the husband have to pray infront? Does the wife have to keep a certain distance? Even if restricted space?

If praying separately the husband has to be in front at least where the wife place of sajdah is behind the husband’s place of the knees

If not possible then the husband and wife must pray one by one