All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
It is better that the discerning child (who is of the age of distinction) sleeps in a separate bed, but if there is a need for sleeping with his parents in one bed, it is permissible provided that their ‘Awrah (private parts) is concealed and their bodies are not touching.
‘Amr ibn Shu‘ayb narrated on the authority of his father from his grandfather that the Prophet, sallallaahu ‘alayhi wa sallam, said, “Command your children to pray when they become seven years old, and beat them for it (for not praying) when they become ten years old; and separate between them in beds.” [Abu Daawood]
Rawdh At-Taalib reads, “It is obligatory to separate between a ten-year-old and their parents and siblings in bed.”
The separation in bed has two meanings: Ash-Shawbari wrote in his commentary on Asna Al-Mataalib, “Separating them in bed may be done in two ways: that each child has his own bed or that they are in one bed but separated and their bodies not touching one another.”
There is no effect on the parents' marriage if their child slept with them in one bed.
Allah knows best.