Joyce found out retroactively through the memory edit of Dawn.
She didn't know at BvD
At the end of the episode, Dawn is inserted into reality and everyone's memory.
Dawn has been friends with Willow and Xander forever in the new memories/reality.
So Willow probably visited Dawn, or Dawn visited Willow more often in S4 in the new memories than in the actual S4.
Joyce picked up on Willow's new 'friend' thanks to the increased contact she had with Willow and Tara in the new memory of S4 and the summer.
So when Dawn writes her journal in The Real Me, Joyce now knows from before BvD.
(As for Joyce, I figure it's a parent's desire to shield the child from even the knowledge of sex. And Joyce would have at best an inaccurate understanding of what W&T do, in magic, and wouldn't be sure of what kind of crossover there would be. And there is the whole "I've already got one daughter fighting the powers of darkness, you can be accountant instead." attitude.)
I
