According to police in Fort Walton Beach, Florida ... 23-year-old Coffee was pulled over for speeding ... but cops quickly discovered that Glen's vehicle -- a 2008 Cadillac -- had no registration or insurance.
Because the vehicle was deemed "unlawful to be on the roadway," cops called for the Cadillac to be towed ... but first, they ran a quick search -- and found a "black 380 SIG Sauer automatic pistol."
According to the police report, obtained by TMZ ... "The pistol was recovered with the hammer 'cocked' to the rear. It was located in the center console ... readily accessible to Coffee."
Coffee was arrested and taken to a nearby station -- where he was booked for carrying a concealed firearm ... a 3rd degree felony.
Coffee had a pretty decent rookie season with the 49ers ... but suddenly "retired" during training camp this year claiming "[God] told me a long time ago to walk away from the game.”