Each pen, Gov. Nikki Haley said, will go to the families of the nine victims of last month's massacre at Charleston's Emanuel African Methodist Episcopal Church.
By showing forgiveness after the shooting, she said, they caused the change of heart that led to passage of the history-making bill.
"This is a story about the history of South Carolina and how the action of nine individuals laid out this long chain of events that forever showed the state of South Carolina what love and forgiveness looks like," she said.
Crowds wanting to be part of the event gathered around the flag on the State House grounds and jammed the lobby to witness the signing.
The flag, a fixture on Capitol grounds for half a century, will be lowered at 10 a.m. Friday, Haley said.
The legislation calls for the flag to be taken down within 24 hours of her signing of the bill and moved to the state's Confederate Relic Room and Military Museum for display
"We're a state that believes in tradition. We're a state that believes in history. We're a state that believes in respect," Haley said before signing the bill. "So we will bring it down with dignity, and we will make sure that it is put in its rightful place."
Early Thursday morning, the S.C. House of Representatives voted 94 to 20 to take down the flag, giving final approval to a bill that passed the state Senate earlier in the week.
The vote count was more than the two-thirds needed, but it came after a handful of lawmakers mounted a tenacious last stand, proposing amendment after amendment that led the debate to drag on more than 12 hours.
"It's bittersweet, because it took a tragedy to bring this body to this decision," South Carolina state Rep. Jenny Horne told CNN"s "New Day" on Thursday morning, referring to the slayings of nine black churchgoers in Charleston three weeks ago. "I am so proud to be a South Carolinian and proud of what South Carolina has done to move this state forward."
Horne, a Republican, delivered an emotional speech on the House floor in favor of removing the flag.
"I felt like ... someone needed to change the course of the debate, because no one had mentioned ... the Charleston Nine," she said. "I would like to think that my remark helped change the course of the debate."
The House vote may even bring immediate benefits to South Carolina. NAACP President Cornell William Brooks said the group will move to lift its 15-year economic boycott against the state during a national convention this weekend.
"When the flag comes down, we lift the boycott," he told CNN's "The Situation Room" Thursday. Removing the flag in South Carolina is an important symbolic victory, he said. But he added that there are battles still to be fought in other states where "emblems of bigotry and bias" still fly.
For decades, African-Americans and others have demanded the flag come down. To them, it's a racist symbol that represents a war to uphold slavery and, later, a battle to oppose civil rights advances.
But their voices were drowned out by supporters who argued it is a symbol of Southern culture.
That all changed last month when a white gunman, 21-year-old Dylann Roof, killed nine African-American worshipers in a historic Charleston church.
After the massacre, photos quickly surfaced of Roof holding the Confederate battle flag, which he apparently revered as a symbol of white supremacy.
The racially motivated attack triggered a national wave of sympathy, outrage and renewed calls to have the battle flag removed.
On Tuesday, the South Carolina Senate voted 36-3 to bring down the flag and handed a clean bill to the House, but things didn't go as smoothly there.
68 amendments proposed
When debate started in the House around noon Wednesday, the flag's supporters proposed a flood of amendments.
And proceedings dragged on into early Thursday, as the amendments were declared out of order or legislators voted to knock them down, 68 in all.
Some proposals were designed to delay action: One suggested holding a referendum on the flag issue during the 2016 presidential election. Another proposed having a museum calculate costs of displaying the flag and return a budget for legislators to consider in January.
Other proposed amendments took up lawmakers' time with minutiae: Replace the flag pole with a pole honoring black soldiers who fought for the Confederacy. Dig up the state flower bed. Protect or remove about a dozen other state monuments.
Each proposal put lawmakers further away from a vote on the bill itself.
It was too much for Horne, who unleashed a tearful admonition on her colleagues. She had been to the funerals of the nine worshipers shot dead inside the Emanuel African Methodist Episcopal Church. And she was still bereft.
"I cannot believe that we do not have the heart in this body ..." she paused, swallowing her sobs and then raising her voice to shout, "to do something meaningful, such as take a symbol of hate off these grounds."
She thrust her finger at fellow representatives with every word of her demand.
Potentially long delays
Had one amendment passed, it would have meant more debate, more bureaucracy and the battle flag would have continued to flap in the wind yards away for weeks, maybe months, Horne said.
"We are going to be doing this all summer long," she protested.
"And if any of you vote to amend, you are ensuring that this flag will fly beyond Friday. And for the widow of Sen. Pinckney and his two young daughters, that would be adding insult to injury, and I will not be a part of it."
Clementa Pinckney was a state senator and was leading the Bible study class at the church when the shooting began. He was among those killed.
Horne left the speaker's podium to land in the tight embrace of an African-American lawmaker colleague standing on the House floor.
The tenacity behind the fight to delay the flag's removal had been fanned outside the House chamber.
The State newspaper reported that pro-Confederate flag
robocalls urged voters last week to call their representatives and to tell them to "not stand with leftist fanatics who want to destroy the South we love."
"What's next? This attack on our values is sick and un-American, and it has to stop right here and right now in South Carolina," the call said.
Legislators had received death threats over their potential votes on the flag, CNN affiliate WOLO reported
And sympathies for the Confederate battle flag go beyond South Carolina's borders.
According to a new CNN/ORC poll, U.S. public opinion on the Confederate flag
remains about where it was 15 years ago, with 57% of Americans seeing it more as a symbol of Southern pride than of racism.
"It's been a long time coming, but I always felt this day would come," tweeted U.S. Rep. James Clyburn, who represents South Carolina's 6th District.
State Rep. Joseph Neal, a Democrat, said he remembered the battle in 2000 to have the flag removed from atop the Capitol dome.
"There were those of us who thought we'd never see this day come," he told CNN's "New Day." "This day is testament to the power of love and unity and grace."