In poetry, an apostrophe is a figure of speech in which the poet addresses an absent person, an abstract idea, or a thing. Apostrophes are found throughout poetry, but they’re less common since the early 20th century. Poets may apostrophize a beloved, the Muse, God, love, time, or any other entity that can’t respond in reality.
The word O is often used to signal such an invocation.
When will you ever, Peace, wild wooddove, shy wings shut,
Your round me roaming end, and under be my boughs? [Gerard Manley Hopkins]
O holy virgin! clad in purest white,
Unlock heav’n's golden gates, and issue forth; [William Blake]
O cunning Love! with tears thou keep’st me blind,
Lest eyes well-seeing thy foul faults should find. [William Shakespeare]