The phrase to give up the ghost means to breathe one’s last breath, to expire, to die.
It is only in this phrase that ghost is still used in the obsolete sense of the soul or spirit, as the principle of life.
The present form of the phrase is first recorded in the Later Version (1395) of the Wycliffe Bible, in which the gospel of Matthew, 27:50, describes the death of Jesus as follows:
Forsothe Jhesus eftsoone [= again] criede with a greet voyce, and ȝaf vp the goost.
The formulation was different in the Early Version (around 1382) of the Wycliffe Bible:
Forsothe Jhesus eftsones cryynge with grete voice, `sente out the spirit.
In the King James Version (1611), this verse is:
Jesus, when hee had cryed againe with a lowd voyce, yeelded vp the ghost.
The image, however, is older; a manuscript dating from around 900 tells how Saint Eleutherius and his mother, Saint Antia, suffered martyrdom under the reign (117-138) of Emperor Hadrian (Publius Aelius Hadrianus – 76-138):
from The Old English Martyrology, edited by Christine Rauer (D. S. Brewer – Cambridge, 2013):
Ond se casere hi het gemartyrian, ond God wuldriende heo ageaf* hire gast.
And the emperor had her martyred, and, praising God, she gave up the ghost.
(* ageaf: past tense of the obsolete verb agive, meaning to give up, to give back)
The phrase to give up the ghost is also used figuratively and humorously, as in the following from The Manchester Mercury; and Harrop’s General Advertizer (Manchester, Lancashire) of Tuesday 4th November 1823:
Decline of the Whig Radical Press.—Within the last twelve or fourteen months, six or eight of the radical weekly journals, and one or two of the daily ones, have given up the ghost.