Actually, what it celebrates is the belated announcement in Texas that Lincoln had freed the slaves. The slaves in Texas did not get the word until several years after the war ended.
Well, not quite "several years" more like several months (from Wikipedia):
Though the Emancipation Proclamation had been issued on September 22, 1862, with an effective date of January 1, 1863, it had little immediate effect on most slaves day-to-day lives, particularly in Texas, which was almost entirely under Confederate control. Juneteenth commemorates June 19, 1865, the day Union General Gordon Granger and 2,000 federal troops arrived on Galveston Island to take possession of the state and enforce the emancipation of its slaves.
The war ended in April of 1865.