In the Bible, Psalm 94:15 reads,
For justice will prevail and all the morally upright will be vindicated.
What does the “for” mean here, and what might be the grammatical use of it?
For here means 'because'. According to the Oxford Advanced Learner's Dictionary, for here is a conjunction which is dated or formal. It is not usually used at the beginning of the sentence.
We listened eagerly, for he brought news of our families.
It doesn't really mean anything. The translators were struggling to render the Hebrew "כִּי", ("ki" - 'for', 'because'). In Biblical Hebrew, sentences often begin with "כִּי" or with "וְ" ("ve-" - 'and') in a way that is quite alien to English. Some translators have felt it was important to render every word, and so often began their sentences with "for" or "and" in a way that doesn't make much sense.
Other translators have rendered this particular verse with "But" (KJV), or with no introductory word at all (NIV).
As others have already mentioned, it means because in the context of this Psalm and I just wanted to add the relevant text here.
The way I understand it, the verses from 12-15 form a single stanza, with the "For" providing a reason for the opening "How blessed is the one whom you instruct":
12 How blessed is the one whom you instruct, O Lord, the one whom you teach from your law,
13 in order to protect him from times of trouble, until the wicked are destroyed.
14 Certainly the Lord does not forsake his people; he does not abandon the nation that belongs to him.
15 For justice will prevail, and all the morally upright will be vindicated.
See also the Revised Standard Version, which I consider closer to the source, using "For" in both verse 14 and verse 15 thus providing two reasons, just as the original Hebrew begins both verses with "כִּי" (because):
12 Blessed is the man whom thou dost chasten, O Lord, and whom thou dost teach out of thy law
13 to give him respite from days of trouble, until a pit is dug for the wicked.
14 For the Lord will not forsake his people; he will not abandon his heritage;
15 for justice will return to the righteous, and all the upright in heart will follow it
A clause introduced with for often presents a context for something that has preceded, offering an explanation or justification for it:
They stopped at a pub and downed a few beers.
For the hard-working are often in need of refreshment
when the day's labors are done.
Sometimes And indeed is a decent paraphrase of the meaning.