How should this expression be used, and what is its origin?
It is an interjection with literal meaning "look and see!" It is used to demonstrate surprise.
According to the Merriam-Webster dictionary, the first known use was in 1808.
As for the etymology, according to the Wiktionary, "lo originated from the shortening of the word look, commonly seen in Middle English texts".
Some interesting examples:
This Bob Dylan's song (1967).
We kept falling back, kept falling back, and lo and behold, after the '88 election, we found ourselves in the worst recession since the Great Depression. Bill Clinton, William J. Clinton (1998)
When the woman went to pick it up - lo and behold! - the cat was sitting quite comfy inside the cave. Rudyard Kipling, Just so stories for little children (1989)
But when she opened the door, lo, and behold! Jack wasn't there! Arthur Rackham, English fairy tales (1994)
Lo comes from Middle English, where it was a short form of lok, imperative of loken, "to look" (see Etymonline, Wiktionary). To behold means "to see, to look at" and comes from Old English bihaldan, "give regard to, hold in view" (compare to behalten in contemporary German). So the literal meaning of the phrase is "Look and see!", but nowadays it is used as a set phrase and an interjection to express surprise. Merriam-Webster says that the first recorded appearance is from 1808. Wiktionary adds that it is "often used ironically or humorously", and the Cambridge Idioms Dictionary marks it as "humorous".
Origin, from wiktionary:
The lo from the expression likely originated from the shortening of the word loke, commonly seen in Middle English texts. Its presence in literature can be traced as far back as the 1800s. The literal meaning of the expression is "look and see", and it is always used as if in the imperative.
It sounds archaic and a bit strange, so use it to get a kind of like.. overly formal/surprised effect.
And then, lo and behold, she returned!
Carine tried her luck at the lottery and, lo and behold, won $1,500 last month.
Hartington... had just told us how hard he had worked all the morning... when, lo and behold! M. Deshayes himself appeared.