"Can I cook or can't I?"
- - Carol Marcus boasting about her scientific achievements, 2285
During the late 2250s or early 2260s, Carol became involved with a young Starfleet officer named James T. Kirk. She gave birth to their son, David. However, Carol felt that she and Kirk had no basis for a lasting relationship, with Kirk traveling around the universe while she worked in a lab, so she asked that Kirk leave her alone to raise the boy. That they both cared more for their careers than they did for each other was never disputed. As Carol saw it, she and Kirk lived in entirely different worlds, and she wanted her son to be raised in hers.
Carol continued with her work, enjoying much success. In 2284, she proposed the most ambitious and potentially dangerous of her plans to the Federation, dubbed "Project Genesis". Once her proposal was accepted for Federation funding, she began a three-stage development process, accompanied by a highly skilled team of scientists which included her son, Dr. David Marcus.
She and her team made remarkable progress and, by 2285, they were ready to try out their new invention. However, before they could find a suitable planet on which to test the Genesis Device, Khan Noonien Singh and his band of "supermen" intervened, bringing Kirk back into her and David's life.
Though she didn't share her son's mistrust of Starfleet, she was incensed when told that her project and all her files were to be taken by the crew of the USS Reliant, under orders of the new Admiral Kirk. She was determined to fight this unexpected incursion into her territory, though she was willing to give her former lover the benefit of the doubt. When it turned out to be Khan, not Kirk, who stole the Genesis Device, she gratefully accepted Kirk's assistance.
Throughout the quest to save the device from Khan's evil plans, it was apparent that, although Carol Marcus still felt affection for Kirk, her true love was her work. Even as havoc was erupting all around, she gazed on the glory of the Genesis Planet forming exactly as her specifications and years of research had indicated it would. The Genesis Project appeared to be a success, and her pride in her work was unmistakable.
The encounter with Khan gave Carol the opportunity to tell David who his father was and to mend some old wounds between her and Kirk. When her son was later killed by Klingons on the Genesis Planet, Carol was left with her projects and her research, the life that had sustained her for many years. (Star Trek II: The Wrath of Khan)
Almost a century later, in 2374, Captain Kathryn Janeway referred to Dr. Marcus in her captain's log, when Janeway was in search of the omega molecule and found herself having to face enforcing the Omega Directive. In her log, she noted that, in spite of her apprehensiveness, she now knew how Carol Marcus must have felt when she developed the Genesis Device, watching helplessly as science took a destructive course. Janeway, however, noted that, unlike Marcus, she had at least chance to prevent it from happening. (VOY: "The Omega Directive")
The notion that gradually transformed into the character of Carol Marcus was incorporated into the plot for Star Trek II as early as the first story treatment written for that film. In this one-page story outline (written by Executive Producer Harve Bennett), Admiral Kirk personally responded to news of a colonial rebellion on a Federation planet specifically because his former relationship with this unnamed woman personally connected him to a leader of the revolution, their son. The plot, in this earliest of its forms, also involved Kirk rescuing the woman from a drifting spacecraft, bringing her aboard the Enterprise, before proceeding to the planet. (The Making of Star Trek II: The Wrath of Khan, pp. 35-36)
The character of Kirk's former lover then received the name Diana, in a nineteen-page outline that Jack B. Sowards went on to develop from Bennett's single-page treatment. She was again rescued by the Enterprise from a refugee ship that originated at the planet undergoing revolution, this time named as Omega Minori IV. However, it was established that she had never informed Kirk of the fact that, as a result of their prior relationship, she now had a son, a fact Kirk nevertheless learned during the course of the adventure. (The Making of Star Trek II: The Wrath of Khan, pp. 37-39)
Subsequent early drafts of Star Trek II featured Dr. Janet Wallace from "The Deadly Years" in the role of Kirk's old flame. Near the start of the next story outline, she sent a personal call to Kirk while both were on Earth, saying that she could use a visit from an old friend. Wallace thereafter intermittently told Kirk and their son about one another, easing tensions between them. She also traveled to Omega Minori IV herself, shortly before her revelation to David that Kirk was his father. (The Making of Star Trek II: The Wrath of Khan, pp. 39-42) This version of the character remained much the same in the film's first script draft, written by Jack Sowards. She was again reduced to hiding in caves with David and the other rebels but also had some significant interplay with Kirk. (The Making of Star Trek II: The Wrath of Khan, p. 45)
In an updated script draft which Sowards submitted, the role that Janet Wallace fulfilled in the story had been replaced with a new character named Carol Baxter. (Star Trek: The Magazine Volume 3, Issue 5; ) While still to undergo some degree of final revision, the character was by now much as it is in the film's final version. (The Making of Star Trek II: The Wrath of Khan, pp. 37-39)
The filming script for Star Trek II describes Carol Marcus as being "in her early forties, attractive and intelligent." The same script draft also states that, at the time she recorded the visual footage in which she proposed Project Genesis, she was "not used to" appearing on-camera. 
It has been suggested (such as in the Star Trek Chronology, 1st ed., p. 151 & 2nd ed., p. 268) that a "little blonde lab technician" mentioned in "Where No Man Has Gone Before" may, in fact, have been Carol Marcus. As depicted in the episode, Kirk almost married this female, after an initial encounter between them was arranged by Gary Mitchell (unbeknown to Kirk) while both males were studying at Starfleet Academy together. Of course, this unnamed character also could have been Janet Wallace or some other woman never shown on-screen.
Upon seeking a suitable actress to play Carol Marcus, director Nicholas Meyer had several goals in mind. He later explained, "I wanted a woman who was beautiful and looked like she could think; a woman who was attractive enough that you could see why Kirk would fall for her, and at the same time somebody who could keep up with him." (Star Trek: The Magazine Volume 3, Issue 5; )
Ultimately, Carol Marcus was played by actress Bibi Besch. She approached this performance on a very basic human level but also as an acting exercise, attempting to make it as believable a portrayal as she could. "I tried to make it as human as possible," remembered Besch, "rather than trying to fit into something that already was because this character hadn't existed before and I didn't really feel that I had to do that [....] It's difficult to play a woman who has had a relationship with someone that everybody knows. So I tried to make it believable for myself. I fantasized about an early affair [between Kirk and Carol Marcus] and why it turned out the way it did. What kind of people we both became, how I got to be where I was, not just as a scientist but as a woman who wouldn't have told Kirk for all those years that he had a son." (The Making of the Trek Films, 3rd ed., p. 171)
Bibi Besch felt that, as written for Star Trek II, the role of Carol Marcus was quite limited, even including the details of her past romance with Kirk. "There was a little bit more about our relationship that didn't end up on the screen. But not much, really. It was sketchy to begin with," the actress related. "Sometimes, I think of my character as just a lot of exposition–a means of getting to the plotline. I would love to do a future Star Trek with a little more exposition." (The Making of the Trek Films, 3rd ed., p. 171)
Carol Marcus was omitted from Star Trek III: The Search for Spock, because Executive Producer Harve Bennett decided not to use her in the story, as a cut-back to that film's budget. (Trek: The Unauthorized Story of the Movies, 3rd ed., p. 87) Though Bennett originally included Carol in the story outline for the movie (later saying, "I thought it might be fun to have her relating to David and have something going with Saavik"), he subsequently deemed the character extraneous to the story and had some difficulties with how to logically account for her having known about David Marcus using unstable protomatter in the Project Genesis matrix. Thus, Bennett not only excised Carol from the third film but also imagined that she had no knowledge of her son's use of protomatter in the matrix. The character's exclusion from the film was initially very difficult for Bibi Besch to accept. However, after she saw the movie (soon after its release), Besch sent a letter of acceptance to Bennett, saying he had been right to omit her part but also communicating a hope that he could find a role for her in one of the later films. (The Making of the Trek Films, 3rd ed., p. 46)
A young Carol Marcus was in an early script draft of the film Star Trek. She would have been represented as meeting Kirk during his adolescence and living near him.  Co-writer Roberto Orci explained, "We wanted to potentially lay down the foundation for [their] friendship [....] And then literally because of the nature of the introductory story and making sure that our core group of characters had the proper amount of story that they deserve, she went into the potential future draft." 
Carol Marcus appears in the Star Trek: Vanguard novel series, set shortly before and during the early part of the original series and centered around Starbase 47, code-named "Vanguard" (Vanguard (station) at Memory Beta, the wiki for licensed Star Trek works). Dr. Marcus was assigned as the civilian chief scientist of the Vault, a top-secret laboratory at Vanguard established following the discovery of the Taurus meta-genome (Taurus meta-genome at Memory Beta, the wiki for licensed Star Trek works). The series implies that the research into the meta-genome provided the basis for Project Genesis. Her mirror universe counterpart appears in a similar position in The Sorrows of Empire.
In the novelization of Star Trek III and Star Trek IV, the relationship between Kirk and Carol breaks down when she discovers Starfleet's intentions to hush up information about Genesis – something Kirk had nothing to do with. She elects instead to pay condolence calls on the families of the Regula One staff that were murdered by Khan. It is during one of these visits that she is informed of David's own slaughter.
At the beginning of the Star Trek VI novel, Carol is visiting one of the families again on the Themis colony (presumably over fifteen years after the Genesis incident) when it is attacked by Klingons – presumably General Chang, using the prototype Bird-of-Prey that will later cause the Enterprise crew trouble. Carol is severely injured and on life support, news which affects Kirk deeply; over the years, he and Carol had healed the rift over David's death and became friends again, and they were planning on making a life together after his retirement. For this reason, his hatred of Klingons is even more extreme in the novel than in the movie – not only did they kill his son, they may have also killed his future life partner.
In William Shatner's novel The Ashes of Eden, Carol and Kirk are initially shown living together in Kirk's San Francisco apartment. However, their relationship seems strained due to Kirk's restlessness regarding his retirement. He ultimately decides to join the Klingon/Romulan hybrid Teilani on a mission to her homeworld, leaving Carol behind.
During the Genesis Wave series, it is revealed that Carol is still alive well into the twenty-fourth century, having been concealed on a distant planet during the Dominion War to prevent her knowledge from falling into the wrong hands. Despite the precautions taken to secure information about the Genesis Project, Carol is captured by a race of sentient plants capable of creating mental illusions, who trick her into creating the "Genesis Wave", a wave of energy that terraforms all planets in its path into something that can be inhabited by this species. However, Carol manages to shake off their illusions during a brief period of illness, and, accompanied by Maltz – the sole Klingon survivor of the original Genesis catastrophe – she destroys the space station that would have launched a second Genesis Wave, both she and Maltz dying in the process.