The Senate rejected the proposed bill 38 to 31, with two abstentions and one absentee.
The bill, which fueled contentious debate, would have expanded abortion rights to allow women to end a pregnancy in the first 14 weeks. Current laws allow the procedure only in cases of rape or when the mother's health is at risk.
A heavy police presence around the National Congress in Buenos Aires quickly quelled scattered confrontations after the vote's outcome was announced. As soon as the vote was announced, fireworks went off outside Congress as jubilant anti-abortion demonstrators dressed in blue -- the color of the "save both lives" movement -- danced and cheered.
Hundreds of thousands of people had gathered outside Congress throughout the day to mark their support for and opposition to the bill that has divided Argentine society.
A small number of pro-abortion rights protestors lit fires and threw rocks and bottles at police, who responded with tear gas and water cannon. Most of the clashes quickly died down. As many as eight people were detained, according to media reports.
Around an hour after the vote most people had left the streets around Congress, leaving them strewn with litter.
Hopes among supporters were briefly raised when Senator Cristina Fernández de Kirchner, who had refused to address abortion during her two terms as Argentina's president, announced she had changed her mind and would vote for the bill.
"It was the thousands of young women who went out to the streets who made me change my opinion," she told the Senate Wednesday. "To see them criticize the realities of a patriarchal society should force all of us to look at this differently."
Although he opposes abortion, President Mauricio Macri said earlier this year that he would not veto the legislation if it passed.
One woman who was demonstrating in favor of abortion rights in Buenos Aires before the vote used Instagram to express her frustration at the result.
"Today no one won," wrote the women who posts under the name Veronnica Diaz. "The abortions WILL KEEP HAPPENING, the women will continue to die in clandestine abortions and your Neanderthal position of 'saving two lives' in a comfortable social inequality will continue without saving ANY LIFE."
Celia Szusterman, trustee of the UK board of Pro-Mujer and director of the Latin America program at the Institute for Statecraft, told CNN that the result was "a step backward for women's rights and women's health."
She says it's a "sad day... not only because of the way the vote went but the way the campaign for and against went. It was so divisive."
But even with its defeat, the groundswell of support for the legislation is not expected to go away, with those who supported the bill saying it was a victory that it was even debated.
Activists say they'll keep pushing the bill, in the hope that it passes one day soon.
"It will happen because that's the world -- to increase rights and this is one of the fundamental rights that is still not available to women in Latin America," Szusterman said.
The bill has ignited passions and sparked widespread protests in Argentina, with anti-abortion campaigners protesting in the streets under blue "save both lives" banners and members of the opposing side in the debate donning green bandanas.
As senators debated the bill into the early hours of Thursday morning, pro-abortion rights activists rallied outside Congress chanting "legal abortion at the hospital" while the Catholic Church held a "Mass for Life" in the capital Buenos Aires.
Speaking during the debate, conservative Senator Marta Varela welcomed the mobilization of anti-abortion campaigners.
"Today I feel like never before that I'm part of a wide sector of our people who defend life in general, from the moment of conception and until death," she said.
Supporters of the bill rallied across the region Wednesday, in Chile, Uruguay, Mexico and Peru, as well as across the Atlantic, in Spain.
While Pope Francis hasn't addressed the legislation directly, he did speak out strongly against abortion just days after the bill was approved by the lower house -- comparing abortion to avoid birth defects to Nazi eugenics.
The pontiff also issued a letter in March, as the abortion debate began, urging Argentines to "make a contribution in defense of life and justice."
Journalist Daniel Politi in Buenos Aires and CNN's Judith Vonberg contributed to this report.