From the 1950s to the 1980s, Caroline worked for the Aperture Science Corporation, alongside the rich, insane and morally questionable Cave Johnson. Evidence would suggest that Caroline held Johnson in high regard and the two were most likely very close, both through Aperture's prosperous and successful years in the 50s and through their period of extreme financial troubles from the 60s onwards.
When Johnson became severely poisoned in the 80s after ingesting moon rocks, he had Aperture begin working on a way to store human consciousnesses in computers so that he could live on after his physical form died, and chose to assign Caroline as the new head of Aperture. He told employees that Caroline would be too modest to take up the position but that they must make her and that they should even transfer her mind into the same computer system as his if they had too. While Johnson apparently died before his mind could be copied to a computer, the Aperture scientists were able to digitize Caroline's mind, most likely against her will, and probably killing her in the process. Caroline then became the computer system and genetic life-form known as GLaDOS.
Centuries later, GLaDOS and the only surviving Aperture test participant, Chell, passed through the ruins of old Aperture, and discovered various recordings of Johnson and Caroline used in old tests. At first GLaDOS remained unaware of who Caroline was, but noticed a familiarity in her voice, until she finally remembered Caroline's identity and her place as a part of herself. The recollection of Caroline seemed to make GLaDOS develop more human qualities, and taught her where in her "brain" Caroline "lived", allowing her to seemingly delete her in the presence of Chell, although it's possible that this was simply a ruse and that Caroline remains a fundamental component of her.
The only image of Caroline that exists within the game is in a hidden portrait of her and Johnson together, which players unlock the 'Portrait of a Lady' achievement for discovering.
Originally Valve had decided that Johnson's assistant was to be a "put-upon scientist" called Greg, however they considered it infeasible to hire a new voice actor just to voice Greg's small handful of lines. Caroline was created in part as a solution for this problem, as it allowed her to be voiced by the existing voice actor for GLaDOS, Ellen McLain.
Unused sound files in Portal 2 contain Caroline's half of a conversation between her and Johnson, in which she emphatically tells him that "I do not want this." "This" referring to the digitizing of her mind. Johnson's portion of the conversation was left unrecorded and the conversation was never used because it sounded too much like Caroline was being raped.