Bibi Sanubar, 35, was kept in captivity for three days before she was shot dead in a public trial on Sunday by a local Taliban commander in the Qadis district of the rural western province Badghis.
The Taliban accused Sanubar of having an "illicit affair" that left her pregnant. She was first punished with 200 lashes in public before being shot, deputy provincial police chief Ghulam Mohammad Sayeedi told AFP.
"She was shot in the head in public while she was still pregnant," Sayeedi said.
The execution is a grim reminder of the Taliban's harsh six-year rule from 1996 to 2001 in Afghanistan. The radical Islamists staged public stonings or lashings of those found to have committed adultery or sex outside marriage.
The then-Taliban government would also chop off the hands and feet of those accused of theft and robbery.