According to websters-online-dictionary.com, the word "soliloquy" was first used in 1613. It refers to a dramatic speech spoken by an actor to no one in particular, like talking aloud to yourself. For instance, Juliet's balcony speech, "O Romeo, Romeo, wherefor art thou, Romeo," is a soliloquy.
According to the online etymology dictionary, the word was first used as a synonym for "monologue":
c.1600, from L.L. soliloquium "a talking to oneself," from L. solus "alone" + loqui "speak." First used in translation of L. "Liber Soliloquiorum," a treatise by Augustine, who is said to have coined the word, on analogy of Gk. monologia (see monologue). Verb soliloquize is recorded from 1759.
Augustine was an influential Christian cleric who lived in the late 4th and early 5th centuries AD. So if he coined the term as the above reference notes, then it is ancient, indeed. As for the first play to use a soliloquy, after doing several searches, I can find only references to Shakespeare's plays. So it may be safe to say that he may not have invented the concept, but he was the first to widely use it.
Your question was asked over three hours ago, and no one else has answered it, so I'll try to answer at least part of it.
Dramatists in the Elizabethan Period use soliloquies frequently. One might say that Shakespeare made the soliloquy famous. This speech presented by a character who is alone on stage, or who at least thinks he/she is alone on stage, is one of the defining characteristics of Elizabethan drama.
But I do not know what the first play to use one is. I do know that Hamlet was not the first, though. Hamlet is not the last play Shakespeare wrote, but it is not the first, either. Other earlier Shakespeare plays include soliloquies.
Well, my friends, Seneca uses soliloquy in Thyestes at the beginning of Act V, Scene II. This would have been sometime between 4 BCE and 65 C.E.--Seneca's life time.