The song is apocalyptic, taking much of its imagery from the Book of Revelation, but excluding its more horrific depictions of the Last Judgment. The "trumpet" is the way in which the end of times is announced. As the hymn expresses the wish to go to Heaven, picturing the saints going in (through the Pearly Gates), it is entirely appropriate for funerals.
Changes in the wording (eg: "And when the sun begins to shine") alters the meaning to a hope for a better world in the here and now.
The version performed by Haley (and others) removes most religious imagery in favor of references to musicians (i.e. "When that rhythm starts to go/I want to be in that number/When that rhythm starts to go.").