Quick search by citation:

18 U.S. Code § 959 - Enlistment in foreign service

(a)
Whoever, within the United States, enlists or enters himself, or hires or retains another to enlist or enter himself, or to go beyond the jurisdiction of the United States with intent to be enlisted or entered in the service of any foreign prince, state, colony, district, or people as a soldier or as a marine or seaman on board any vessel of war, letter of marque, or privateer, shall be fined under this title or imprisoned not more than three years, or both.
(b)
This section shall not apply to citizens or subjects of any country engaged in war with a country with which the United States is at war, unless such citizen or subject of such foreign country shall hire or solicit a citizen of the United States to enlist or go beyond the jurisdiction of the United States with intent to enlist or enter the service of a foreign country. Enlistments under this subsection shall be under regulations prescribed by the Secretary of the Army.
(c)
This section and sections 960 and 961 of this title shall not apply to any subject or citizen of any foreign prince, state, colony, district, or people who is transiently within the United States and enlists or enters himself on board any vessel of war, letter of marque, or privateer, which at the time of its arrival within the United States was fitted and equipped as such, or hires or retains another subject or citizen of the same foreign prince, state, colony, district, or people who is transiently within the United States to enlist or enter himself to serve such foreign prince, state, colony, district, or people on board such vessel of war, letter of marque, or privateer, if the United States shall then be at peace with such foreign prince, state, colony, district, or people.
Historical and Revision Notes

Based on title 18, U.S.C., 1940 ed., §§ 22, 30 (Mar. 4, 1909, ch. 321, §§ 10, 18, 35 Stat. 1089, 1091; May 7, 1917, ch. 11, 40 Stat. 39).

Section consolidates said sections of title 18, U.S.C., 1940 ed. Last sentence of section 30 of title 18, U.S.C., 1940 ed., relating to piracy and treason, was omitted as unnecessary.

Words “within the United States” were substituted for “within the jurisdiction” etc., in view of the definition of United States in section 5 of this title.

References in subsection (c) to sections 960 and 961 of this title are to the only other sections to which the subsection can apply.

Mandatory punishment provision was rephrased in the alternative.

Minor changes were made in phraseology.

Editorial Notes
Amendments

1994—Subsec. (a). Pub. L. 103–322 substituted “fined under this title” for “fined not more than $1,000”.