Sean Simpson, 43, absentmindedly left the loaded weapon inside a cubicle, says Broward County Sheriff’s Office.
It was found by a homeless man who fired a bullet into the wall before Mr Simpson snatched it from his hands.
The Marjory Stoneman Douglas High School teacher previously said he was open to the idea of arming teachers.
Mr Simpson told police on Sunday he realised he had left the legally registered pistol in the toilet at the Deerfield Beach Pier after hearing a single gunshot.
After running back to the bathroom, the science teacher encountered a homeless man holding the gun, who, he added, appeared drunk.
Police arrested Mr Simpson and Joseph Spataro, 69, at the scene.
Mr Simpson was charged with failing to safely store a firearm, and was released after paying a $250 (£175) cash bond.
Mr Spataro, who told police he fired the Glock 9mm handgun to see if it was loaded, was charged with firing a weapon while intoxicated and trespassing.
Mr Simpson had voiced support for additional gun control measures after the mass shooting by a 19-year-old former student at his school on 14 February.
Last month, he attended the March for Our Lives protest in Washington DC.
Mr Simpson also previously expressed an openness to the notion of arming and training educators to fight back against school shooters.
“I know there are some of us that are willing to take the training if it was offered and probably be another line of defence,” he said in an interview with MSNBC.
“But again that is a complicated subject and I’m not sure if it’s the answer. I think it’s easier to get these types of weapons out of the hands of people that aren’t meant to do anything but kill.”
A spokeswoman for the Broward County School Board said the district is not expected to take disciplinary action against him, according to WPLG-TV.
On Tuesday, the Broward School Board unanimously rejected the state’s new programme to arm school staff, according to the Miami Herald.
- Countries: United_States
- Hurricane Dorian targets the Bahamas -Evacuation Ordered from Cays
- JAMAICA | Reggae Girlz to be Honoured in Washington DC
- Hurricane Michael | Floridians told to ‘LEAVE NOW’ as evacuation orders issued
- CUBA-Aquariums in Havana and Tampa to further partnership in 2017
- Jamaica's Ambassador to focus on strengthening US Diaspora and trade relationships