James explains the reasoning employed in verse 10 in the immediately following verses:
For he who said, "Do not commit adultery," also said, "Do not murder."
Now if you do not commit adultery but do commit murder, you have
become a violator of the law. (Jas 2:11-12 ESV)
James is expressing the Jewish view (shared by Romans) that the law was considered an interdependent whole, and any infraction constituted a breaking of the law as a whole. It is a recognition that those who are obliged to keep the law are obliged to keep all of it and any failure to do so makes one a lawbreaker. While James employs Jewish reasoning and cites commandments from the Decalogue, however, he isn't thinking of the OT law per se, but the law as reinterpreted by Jesus. Douglas Moo explains thus:
In vv. 10–11 James justifies (for) the last clause of v. 9 by showing
that the breaking of even one commandment incurs guilt for the law as
a whole. We are presented with a chain of reasoning that leads at the
end of v. 11 to the same accusation James has already leveled in v.
9—Christians who show favoritism are “transgressors of the law.”
James’s assertion of the law’s unity is nothing new, for Jews and even
pagans had frequently made the same point. … See, for instance, the
response of the pious Eleazar when commanded to eat forbidden food:
“Do not suppose that it would be a petty sin if we were to eat
defiling food; to transgress the law in matters either small or great
is of equal seriousness, for in either case the law is equally
despised” (4 Macc. 5:20–21; see also b. Horayot 8b; b. Shabbat 70b;
1QS 8:16; T. Asher 2:5–10; Philo, Allegorical Interpretation 3.241).
Paul reflects the same tradition in Gal. 5:3: “I declare to every man
who lets himself be circumcised that he is obligated to obey the whole
law.” But especially significant, as is usually the case for James, is
Jesus’ teaching: “I tell you the truth, until heaven and earth
disappear, not the smallest letter, not the least stroke of a pen,
will by any means disappear from the Law until everything is
accomplished. Anyone who breaks one of the least of these commandments
and teaches others to do the same will be called least in the kingdom
of heaven” (Matt. 5:18–19).
James signals that he is citing proverbial truth in vv. 10–11 by
interrupting the second person plural direct address of vv. 8–10 and
12–13 with the third person singular style of “customary” or “gnomic”
truth (whoever …). The hypothetical nature of the situation makes it
unnecessary to follow Johnson in giving a conative sense to the verb
“keep” (e.g., “undertakes keeping the whole law”). James is not
suggesting that anyone is in reality fulfilling every demand of the
law; he simply puts forth a “suppose it were so” assumption. That
person, were he to “stumble” (i.e., fail to obey; cf. 3:2; Rom. 11:11;
2 Pet. 1:10) at even one “point” (or commandment), is guilty of
breaking all of it. The NIV rendering here is very appropriate. Some
versions simply translate “have become a transgressor of the law”
(NRSV), but leave out the notion of judicial guilt that the word James
uses here seems to have (enochos; cf. six of the seven other NT
occurrences: Matt. 5:21, 22; 26:66; Mark 3:29; 14:64; 1 Cor. 11:27;
Heb. 2:15 is less clear).
…James now explains why the law is an indivisible unity. As Johnson
puts it, “Critical to the argument is that the commandment is not just
a text but ‘someone speaking’” [Luke Timothy Johnson, The Letter of
James (Anchor Yale Bible Commentary) 232]. If we view the law as a
series of individual commandments, we could assume that disobedience
of a particular commandment incurred guilt for that commandment only.
But, in fact, the individual commandments are part and parcel of one
indivisible whole, because they reflect the will of the one Lawgiver.
To violate a commandment is to disobey God himself and render a person
guilty before him.
…Pressed to its logical conclusion, James’s argument would require
obedience to every single commandment of the law, including the
requirements concerning ceremonial observances. Is this what James
intends? Nothing in his letter would suggest that he holds so strict a
view. And he does give us a hint within vv. 10–11 that this is not the
case. Generally when Jewish theologians made the point that James
makes in v. 11, they cited a “light” commandment to set beside a
“heavy” one. Thus Eleazar, in the 4 Maccabees text quoted above,
asserts that eating defiling food (a “small” matter) is equally as
serious as disobedience of a “great” commandment. But James cites two
Decalogue commandments, of supposedly equal “weight.” He therefore
suggests that he is thinking only of some parts of the OT law in vv.
10–11. Corroboration of this suggestion comes from early Christianity,
where the love command was closely associated with the “fellowman”
commandments of the second table of the Decalogue (see Matt. 19:18–19;
Rom. 13:8–10). Therefore, while employing logic drawn from the OT and
Jewish orthodoxy, James applies it to a new situation. It is not the
OT law per se that he urges perfect compliance with, but “the royal
law” (v. 8), “the law of liberty” (v. 12; cf. 1:25). This “law” takes
up within it the OT law, but as understood through Jesus’ fulfillment
of it. And so just as Jesus’ apparent unqualified endorsement of the
law (Matt. 5:18–19, quoted above) is tempered in the context by his
claim to be the fulfiller of the law (v. 17), so James applies this
standard point about the law’s unity to the law as reinterpreted by
Jesus….
[Douglas J. Moo, The Letter of James (The Pillar New Testament
Commentary; Grand Rapids, MI; Leicester, England: Eerdmans; Apollos,
2000), 113–117.]
As to whether or not all sins are capital sins deserving of eternal judgment, Paul says in Romans 6:23 that the wages of sin is death. He doesn't qualify his assertion, as if to say that the wages of only some sins is death. Sin, all sin, by its nature merits death. Happily, Paul goes on to say that the gift of God is eternal life in Christ Jesus our Lord. The salient question for us, then, is not whether we have ever sinned (for we all have) but whether we are in Christ Jesus. Are we abiding in him? (John 15:1-16)