I want to know if a husband is praying his sunnah prayer and a wife her fard prayer in the same room separately, is it still necessary for the wife to stand behind him like in the next row? Or if she is 1-2 steps behind is ok? Or she can stand besides him but a little away?.
If each of them is praying on his or her own, then she may stand wherever she wants, next to her husband or in front of him or behind him, because there is no connection between their prayers.
But if she is following him in prayer, then she should stand behind him as is indicated by the Sunnah. Al-Bukhari (380) and Muslim (658) narrated from Anas (may Allah be pleased with him) that his grandmother Mulaykah invited the Messenger of Allah (blessings and peace of Allah be upon him) to eat some food that she had made. He ate some of it, then he said: “Get up and I will lead you in prayer.” Anas ibn Malik said: I went to a reed mat of ours that had turned black from long use, and sprinkled it with water, then the Messenger of Allah (blessings and peace of Allah be upon him) stood on it, and the orphan and I stood behind him, and the old lady behind us, and the Messenger of Allah (blessings and peace of Allah be upon him) led us in praying two rak‘ahs, then he left..
If the husband and wife are both praying behind the same imam, or if men and women of praying behind an imam, the Sunnah is for the wiomen to be behind the men. But if the woman in that case prays parallel to the man, the prayer of all is valid according to the majority of scholars, because there is no evidence to indicate that it is invalid.
If a man and a woman pray together behind one imam, or the men and women pray behind one imam, the Sunnah is for the women to pray behind the men. But if the woman prays alongside the man in that case, the prayer is valid for both according to the majority of scholars, because there is no proof to indicate that it is invalidated.
The Hanafis are of the view that if a woman prays beside men without a barrier, that invalidates the prayer of three of the men: one on her right, one on her left and the third behind her, according to the conditions that they mentioned. But their opinion is not valid because there is no evidence to that effect, as has been explained in the answer to question no. 79122
But the scenario asked about here does not come under this difference of scholarly opinion, because the one who is praying on her own is not following her husband, and they are not both following another imam. So there is no difference of scholarly opinion as to the validity of the prayer of both, even if she stands in front of her husband or next to him.
And Allah knows best.