"The pistol will be hidden and the agent will use it only in the case of violence, in order to defend himself," an SBB spokesman said.
Some 200 security agents patrol Swiss stations and trains at the moment, and their number will increase to 250 in 2012.
Cases of physical violence against train personnel fall between 2005 and 2010 from 278 to 147, but the number of serious attacks has increased, said the spokesman.
The Swiss government in August authorised SBB to provide firearms to its security agents. The Swiss parliament, which was also consulted, was unable to find an agreement on the topic, and had asked the government to decide.
Swiss border, cantonal and military police are already allowed to carry firearms on trains.