For what it's worth, I skimmed through Thomas W. Talley's 1922 "Negro Folk Songs" and Dorothy Scarborough's 1925 "On The Trail Of Negro Folk Songs" looking for any song that had the words "O Freedom" or the verse "And before I be a slave/I'll be buried in my grave" and go home to my Lord and be free" {or "and be saved"}.
Neither book has any verse that is remotely similar to that.
Both these books have the "poor mourner/you will be free/when the good Lord sets you free" verse which was often used as a chorus. And there are a few other songs in both books that mention being free.
I think that its most likely that O Freedom was composed after the Civil War. If it is based on any song, I bet that it was a spiritual and not a secular song.
That said, secular songs often have a religious or serious chorus, such as the "poor mourner" example that I referred to. So sometimes the line separating what is a religious song and what is a secular song might be blurry...except that you only do a holy dance when you sang religious songs and you could do all kinds of other moves, such as crossing your legs, when you dance to the devil's music...