  In particle physics model building discrete symmetries are often invoked to
forbid unwanted or dangerous couplings. A classical example is the R-parity of
the MSSM, which guarantees the absence of dimension four baryon- and
lepton-number violating operators. Although phenomenologically useful, these
discrete symmetries are, in the context of field theory, poorly motivated at a
more fundamental level. Moreover, discrete {\em global} symmetries are expected
to be violated in consistent couplings to quantum gravity, while their {\em
gauged} versions are expected to actually exist. In this paper we study
discrete gauge symmetries in brane models in string theory, and argue that they
are fairly generic in this framework. In particular we study the appearance of
discrete gauge symmetries in (MS)SM brane constructions in string theory, and
show that a few discrete ${Z_N}$ gauge symmetries, including R-parity and {\it
baryon triality}, appear naturally as remnants of continuous U(1) gauge
symmetries with St\"uckelberg $N(B\wedge F)$ couplings. Interestingly, they
correspond to the simplest anomaly-free discrete symmetries of the MSSM as
classified in the early 90's. We provide a number of examples based on type IIA
intersecting brane constructions with a (MS)SM spectrum. We also study the
appearance of discrete generalizations of R-parity in unified SU(5) type IIA
orientifolds and local F-theory SU(5) GUTs.
