The 2009 law was intended to prevent a mother from picking the gender of her child through abortions.
It made it illegal for a doctor to do the procedure if the doctor knew a woman's sole reason was she wanted a baby of a different sex. Attorneys said worldwide most abortions done for gender reasons involve female fetuses.
Oklahoma County District Judge Dan Owens ruled Friday that legislators put into the law multiple subjects unrelated to its underlying purpose. He ruled the law violated a requirement in the state constitution that legislation cover a single subject.
"It's pretty disturbing we have to pass a statute to prevent people from doing that," the judge said of gender-selection abortions. "It's uncivilized."