"For I know that whomever you bless is blessed, and whomever you curse is cursed" (Numbers 22:6). From where did he know? At the time when Sihon sought to wage war against Moab, he was afraid, because they were mighty men; so he hired Balaam and his father to curse Moab. For thus it says: "Therefore those who speak in parables say…, for a fire has gone out from Heshbon…, woe to you, Moab…" (Numbers 21:27, 28, 29). Therefore he said, "For I know…"
Why Balak Knew Balaam's Curse Could Destroy Moab
Midrash Tanchuma Buber, Balak 6:5
כי ידעתי את אשר תברך מבורך ואשר תאור יואר (שם). מנין שהיה יודע, שבשעה שביקש סיחון להלחם במואב היה מתיירא, לפי שהיו גבורים, שכר בלעם ואביו לקלל את מואב, שכן הוא אומר על כן יאמרו המושלים וגו', כי אש יצאה מחשבון וגו', אוי לך מואב וגו', (שם כא כז כח כט), לכך אמר כי ידעתי וגו'.