Gov. Dennis Daugaard signed the measure into law Friday.
Passage of the law comes amid a passionate nationwide debate over arming teachers, stoked after 20 first-graders died in an elementary school shooting in Newtown, Conn., in December.
Shortly afterward, the National Rifle Association proposed a plan for armed security officers in every school. Legislation to allow school personnel to carry guns was introduced in about two dozen states. All of those measures had stalled until now.
Several other states already have provisions in their laws - or no legal restrictions - that make it possible for teachers to possess guns in the classroom. In fact, a handful of school districts nationwide have teachers who carry firearms.
But South Dakota is the only state known to have a statute that specifically authorizes teachers to possess a firearm in a K-12 school, according to Lauren Heintz, a research analyst at the National Conference of State Legislatures.
Rep. Scott Craig, a freshman Republican in the South Dakota House who sponsored the bill, said he hoped the measure would shift the country's discourse on school safety.
"Given the national attention to safety in schools, specifically in response to tragedies like in Connecticut, this is huge," he said.
The law leaves it up to school districts to decide whether to allow armed teachers. It remains to be seen, however, whether many schools will permit guns in classrooms and whether the measure will reverberate nationwide. Daugaard, a Republican, said he did not think that many schools would take advantage of the option, but that it was important for them to have the choice.
While many gun control advocates are horrified by the notion of guns in schools, Laura Cutilletta, a senior staff lawyer with the San Francisco-based Law Center to Prevent Gun Violence, said that what South Dakota did would not spark a national trend.
"For South Dakota to do this is less of a concern than if we saw it in Colorado or somewhere else like that, which we consider a more reasonable state as far as gun laws go," she said.
Andrew Arulanandam, a spokesman for the NRA, said the group supported the bill and lobbied for it in the South Dakota Legislature.
"There's certainly not a one-size-fits-all approach to keeping our children safe in schools," he said. "It's incumbent upon state and local governments to formulate and implement a plan to keep students safe."
The law says that school districts may choose to allow a school employee, a hired security officer or a volunteer to serve as a "sentinel" who can carry a firearm in the school. The school district must receive the permission of its local law enforcement agency before implementing the program. The law requires the sentinels to undergo training similar to what law enforcement officers receive.
"I think it does provide the same safety precautions that a citizen expects when a law enforcement officer enters onto a premises," Daugaard said. He added that this law was more restrictive than those in other states that permit guns in schools.
Opponents, which included state associations representing school boards and teachers, said the bill was rushed, did not make schools safer and ignored other approaches to safety.
Wade Pogany, the executive director of the Associated School Boards of South Dakota, said he believed more discussion was necessary before passing this bill. "If firearms are the best option that we have, I'll stand down," Pogany said. "But let's not come into a heated, emotional debate about this and say this is the answer. This is premature."
Supporters say the measure is important in a state where some schools are many miles away from emergency responders, who can take upward of 30 or 45 minutes to reach some areas.
But Don Kirkegaard, the superintendent of the Meade School District, which encompasses 11 schools over 3,200 square miles, said that although some of his institutions were isolated, he did not see any evidence to suggest that they would be safer if teachers were armed. Kirkegaard said schools in more populated areas had been most affected by shootings. "The likelihood of it happening in our rural attendant centers is not nearly as probable as it is in the urban city areas," he said.
But his school district does employ an armed resource officer affiliated with the police who bounces between schools.
Opponents of the legislation said they would be more comfortable with providing resources to districts so they could hire law enforcement to protect the schools.