Gerstein was drafted into the IDF in 1979, and volunteered for the Shayetet 13 naval commando force, but was dismissed after a year, and did his military service in the Golani Brigade. He served as a soldier, a squad leader in the brigade's reconnaissance company. In 1981 he became an infantry officer after completing Officer Candidate School and return to the Golani Brigade. In the 1982 Lebanon War he served as a platoon leader in the reconnaissance company and fought at the Battle of the Beaufort. Gerstein was injured during the battle but stayed on until the fighting was done. In February 1983, he left the army as a company commander, and in June of that year, he left Israel with his girlfriend on a backpacking trip throughout the Americas. He returned to Israel after a year, and joined Shin Bet, but during his training, he dropped out.