I ask this Question on behalf of my neighbor.
Their 12 year old son saw his parents having sex.
As there is only one room in their home we can't say its the parents' mistake... but now the question is how do they handle the situation?
If he is 12 then it is a PERFECT time to have the sex talks with him. When my boy was 4 he walked in on us in the middle of the night, should have still been asleep. He is now 12 and still remembers but he doesn't seem to be any more or less interested or disturbed about that subject matter than other kids his age. He talks about it as if it was mater of fact yet still treats it as a taboo subject like kids should.
Not talking about it might have kept it "exciting" and that isn't what I think would have been best in that situation. We don't talk about it all the time, but when we do, I think it is easier to get to the heart of the matter with him. Now I have to worry about how to talk with my 7 year old daughter...
I believe that parents should be there to help a child who asks for help. If the child does not ask for help, don't force it, unless the child shows signs of having problems and not being able to deal with them.
In the current context this means:
If the son behaves normally, there is no reason to force a conversation. It is not the son's duty to help the parents alleviate their feelings of shame or guilt or worry.
If the son appears disturbed by what he witnessed or seems to want to ask what was going on but does not dare, they should ask him, "would you like to talk about what happened?" The rest of the conversation depends on the son's answer: do you have to explain sex? do you have to explain that daddy did not hurt mommy? do you have to explain that parents enjoy physical contact? etc. The son will state what he wants to know. The parents may only help him express what his questions are. They should know their son well enough to recognize the signs of a question waiting to be encouraged.
If the son behaves in a disturbingly different way (does not allow physical contact any longer, appears afraid etc.), talk to him and, if you cannot help him with explaining (see 2), talk to a psychologist.
I believe (3) is highly unlikely in a normal family with normal children in a Western country.
When I was 10-12 years old, I often ended up in the situation of being awake in a hotel room with my parents when they were having sex. Aside from having to lie very still for a long while when I urgently needed to get up to use the toilet, it didn't hurt me. I was mostly concerned that my parents not know that I was lying there awake and listening (it was dark so of course I could not see) through the whole thing.
I often wondered why they could not wait a day or two until they got back home, or got a separate room for me and my younger brother (who always slept like a rock anyway)? I also suspected that my mother knew I was awake, but was in a difficult position, which is the main thing that bothered me, aside from waiting so long to get up to use the toilet.
My parents always wanted me to go to bed too early, so by the time they went to bed, I needed to relieve myself. Nights when my father was very brusque and said "go to bed!" I always knew what was coming. Not very fun.
In a way it caused me to lose respect for them, but I was not "grossed out" or thought it was weird or anything. I have never understood people being freaked out by knowing their parents have sex - they got born, right?
I don't have a direct answer for you because it was never dealt with and I did not have children. I guess I would just respond to whatever the child said or did. If they appeared to know and were not interested in talking about it, then I would not push it. As others have noted, children have survived for a million years knowing that their parents have sex. Thinking it is to be hidden or that there is something unusual about it is a "modern problem".
Ask the child to excuse your for a minute. Then, dress up quickly and attend to the child's needs, if any. If he/she brings up the topic, then you might have to discuss about sex. If he did not see much, you could probably pass it off as cuddling. If he saw too much, then you will have to explain everything to him, obviously in a way that he can understand.