Here "to remain before God" means to be in God's presence or to be with God. This can be stated clearly in the translation. Alternate translation: "God will be with him forever" or "God will be with the king forever" (See: [[rc://en/ta/man/translate/figs-explicit]])