According to The Voyage Home novel (page 11), Jedda and Zinaida's "spouses/partners" told Carol about David when she beamed down with Zinaida's body to Delta. If you are wondering who Jedda and Zinaida were, they were scientists on Regula-1. Zinaida was one of the scientists who's throat Khan cut and hung upside down on the station, and Jedda was killed by phaser fire from Captain Terrell in the Genesis cave.
According to The Undiscovered Country novel (page 4), Kirk didn't get to see Carol face-to-face for a year after David died. It also said that circumstances made it impossible for Kirk to be the one to tell her about David.