"The Star" is a reference to the Messiah, and "out of Jacob" is interpreted even by Jewish commentaries as "the son of David" which you quote. Interestingly, many in Matthew's day called Jesus "son of David"(Matt. 9:27,12:23,15:22,20:30,20:31,21:9,21:15) so the teachers of the day must have taught that the Messiah was the "son of David".
In the KJV it says:(Num.24:17-18)
"I shall see him, but not now: I shall behold him, but not nigh:
there shall come a Star out of Jacob, and a Sceptre shall rise out of
Israel, and shall smite the corners of Moab, and destroy all the
children of Sheth.
And Edom shall be a possession, Seir also shall be a possession for
his enemies; and Israel shall do valiantly.
The "corners of Moab" are different than the "foreheads of Moab"; since both Moab and Edom became territories(Moab is modern day Jordan), (Edom is Northwestern Arabia), the future reference to the prophecy is territorial-Moabs 'corners' are in contention today-although God gave Moab their land(Dt. 2:9). Part of Edom(Sinai Peninsula) is in Israeli hands, the other part in Saudi Arabia's-fulfilling the prophecy.
What one must remember is that the context for this prophecy is "the latter days"(vs 14), therefore, the "Dual Fulfillment" spoken of by Maimonides by both "David", and the "son of David"(Messiah). The enemies are the same, yet the reference is greatly expanded. Numerous expositors have commented on "the sons of Sheth" as meaning the "sons of Seth", essentially all mankind, as Noah came from Seth.
Keil and Delitzsch had this to say:(from Commentaries, Numbers 24)
And neither the Samaritan text nor the passage in Jeremiah (Jeremiah
48:45), which is based upon this prophecy, at all warrants an
alteration of the reading קרקר into קדקד (the crown of the head),
since Jeremiah almost invariably uses earlier writing in this free
manner, viz., by altering the expressions employed, and substituting
in the place of unusual words wither more common ones, or such as are
similar in sound (cf. Kper, Jerem. libror, ss. interpres atque vindex,
pp. xii.ff. and p. 43). - כּל־בּני־שׁת does not mean "all the sons of
Seth," i.e., all mankind, as the human race is never called by the
name of Seth; and the idea that the ruler to arise out of Israel would
destroy all men, would be altogether unsuitable. It signifies rather
"all the sons of confusion," by which, according to the analogy of
Jacob and Israel (Numbers 24:17), Edom and Seir (Numbers 24:18), the
Moabites are to be understood as being men of wild, warlike confusion.
שׁת is a contraction of שׁאת (Lamentations 3:47), and derived from
שׁאה; and in Jeremiah 48:45 it is correctly rendered שׁאון בּני
Therefore, it is possible that instead of "Sheth" meaning "Seth", it means "Heth"; which was the 2nd son of Canaan:(Wikipedia)
Heth is, according to Genesis 10:15, the second son of Canaan, who is
son of Ham, son of Noah. Heth is the ancestor of the Hittites, second
of the twelve Canaanite nations descended from his sons, who lived
near Hebron (Genesis 23:3,7). In Genesis 10:15-16, Heth is placed
between Sidon and the Jebusites, Amorites, Girgasites, Hivites,
Arkite, Sinite, Arvadite, Zemarite, Hamathite and other peoples,
showing their descent through their children, called "Children of
Heth"(Genesis 23:3, 5, 7, 10, 16, 18, 20)
who's 'daughters'(descendants) married Esau(Edom) and lived in Mt. Seir. The "Hethites" were a part of the Canaanite nations to be destroyed; this prophecy is to be fulfilled in Zech. 14:21. It is significant to note that although God gave Mt. Seir to Edom(Dt.2:5), they obstructed the passage of the children of Israel(Num. 20:18), and frequently attacked them without provocation(Ps. 137:7)
To conclude: these "traditional enemies" who attempted to conjure Balaam to prophecy against Israel show up again as "modern enemies", which the Lord will destroy when "His feet touch the Mt. of Olives".(Zech. 14:3-4)
Then shall the LORD go forth, and fight against those nations, as
when he fought in the day of battle.
And his feet shall stand in that day upon the mount of Olives, which
is before Jerusalem on the east, and the mount of Olives shall cleave
in the midst thereof toward the east and toward the west, and there
shall be a very great valley; and half of the mountain shall remove
toward the north, and half of it toward the south.