Meaning of 'im
KJV and LEB have "if". This is the translation I would go with. Although KJV suffers from less reliable source texts and archaic english, it very often has the best literal translations assuming the source text is not in dispute, so I recommend always checking KJV if a literal translation is desired.
The primary meaning is "if". However this word is subject to some idiomatic usage that allows it to sometimes be interpreted as "not", "since", "when". So it might be better to think of it as a generic conditional. TWOT has a nice write up of these idioms:
אִם (ʾim) if, not, whether, when, since. (ASV, RSV vary considerably in as much as the context and interpretation of the text
determine the exact translation of this particle.) The basic meaning
is “if” and this meaning can be seen in most of its occurrences. In
the hundreds of passages where the word occurs, several basic types of
contexts can be seen.
First, it occurs most often in conditional clauses, e.g. Gen 4:7; Jud
13:16; I Sam 20:14. etc.
Next we find many occurrences of ʾim in oath
contexts in which, in reality, a larger context is assumed. In the
larger, assumed context is an oath, only rarely stated in full (II Kgs
9:26; cf. Job 1:11). Sometimes the oath involves a negative as in II
Sam 19:13. David is here promising to make Amasa his new commander in
place of Joab. He calls on the Lord to judge him severely (the
judgment is never spelled out, perhaps because it is so awful as to be
unspeakable) if Amasa is not to be David’s commander. Other examples
of the full oath are found in I Kgs 20:10 (used by Ben-Hadad), II Kgs
6:31 (also Ben-Hadad). This suggests that the oath was in broader use
than Israel alone, among the Semites at any rate. From this fuller
form of the oath, we see the practice frequently of abbreviating the
oath, omitting “the Lord do so to me and more also.” Thus in Gen
14:23, “If I shall take a thread or a sandal-thong or if I shall take
from anything which is yours” or in other words “I will not take.” Other examples of this abbreviated form,
even at times apparently God
swearing by himself, are as follows: Num 14:30 (God declaring that
none except Caleb and Joshua will come in “_______ if you will come
in” = “you will not come in”; I Sam 17:55, “________ if I know” = “I
do not know,” etc. The peculiar result of this idiom is that in such
contexts ʾim has negative force; ʾim lōʾ is positive. This Hebrew
idiom, coming through the LXX, is rightly interpreted in Heb 3:11, 18
(KJV), but missed in 4:3, 5 (KJV).
A third context in which ʾim occurs
is that of alternatives. Frequently this idea is conveyed by a double
use of ʾim, e.g. Ex 19:13, “if beast if man … ” = “whether a beast or
a man”; I Chr 21:12, “if three years … and if three months … and if
three days … ” = “whether … or … or … ”.
In some contexts ʾim seems to
have the force of “when” as in Gen 38:9. Even here however, the
meaning “if” is seen in the sense of a continuing condition: “whenever
he came in … he would spill … ” or “if he came in … ”, this is what he
did. Here we see the waw joined to the verb as waw consecutive, making
it in effect an imperfect.
We also find several cases of the use of
ʾim in the sense of “since.” In Job 14:5, for example, “since his days
are numbered” may also be “if his days … ” and in Job 22:20, “since
our enemies are cut off” may equally read “surely our enemies … ”
(ASV, RSV) or even “if our enemies … ”. In Jer 23:38, we can read
either “if you say” or “since you say.”
Often we find ʾim used as an
interrogative particle. In Gen 38:17, for example, we can read Tamar’s
response to Judah “will you give … ” or “if you will give … ” When the
structure is accompanied by the sign of the interrogative as in Josh
5:13, then there is no uncertainty. Actually it is quite usual to have
an interrogative he carried on by ʾim (cf. disjunctive and double
questions, GKC par. 150, g. h).
Scott, J. B. (1999). 111 אִם. R. L. Harris, G. L. Archer Jr., & B. K. Waltke (Eds.), Theological Wordbook of the Old Testament (electronic ed., pp. 48–49). Chicago: Moody Press.
Relevance to interpretation
Using the "if" meaning will not help answer why God became angry, because the men really did go to call on Balaam, so the conditions are satisfied. A number of commentators have tried to address this question, and consensus does not focus on the 'im but rather the ki ("because" in "God became angry because he went"). Here is NICOT:
The most common question about this verse is the motive for God’s
anger with Balaam. At the very least it seems capricious for God to
tell Balaam to go on his way in v. 20 and then to become angry with
Balaam because he was going in v. 22. The question is whether the
particle kî (usually translated “because, since” in this verse) should
not have another of its well-attested meanings, viz., “when” or even
“as” with the participle. This construction is somewhat rare, but not
unknown in Biblical Hebrew. If one translates temporally, as above,
then God no longer becomes angry with Balaam on the grounds of his
going (since God had given him permission to go in v. 20), but as he
was going, i.e., somewhere on the journey for an unspecified reason.
This view admittedly sidesteps the issue of the motive for God’s
wrath, but, if the translation proposed is correct, so does the text
Ashley, T. R. (1993). The Book of Numbers (pp. 454–455). Grand Rapids, MI: Wm. B. Eerdmans Publishing Co.
In the rabbinical tradition, the cause of God being angry is that Balaam, in his heart, was too eager to go.
According to tradition, Balaam’s acquiescence indicates his eagerness
to curse Israel, thereby arousing the anger of God
Milgrom, J. (1990). Numbers (p. 190). Philadelphia: Jewish Publication Society.