On the outskirts of Herat, Mariam lives with her embittered mother, Nana, in a secluded hut. Born as a result of an extra-marital liaison between her mother and Jalil, a wealthy local businessman, the family lives outside of the city in order to avoid confronting Jalil's three wives and nine legitimate children. Nana resents Jalil for his mistreatment of her and his deceptive attitude towards Mariam, whom he visits every Thursday. On her fifteenth birthday, Mariam asks her father to take her to see Pinocchio at a cinema he owns and to introduce her to her siblings. Jalil promises to do so but when he does not come to pick her up, Mariam travels to Herat herself, against the wishes of her mother. Mariam makes her way to her father's home, where she is not allowed in and is informed he is away on a business trip; after spending the night on the street, Mariam is able to storm the house's garden and sees that Jalil is home. Upon returning to her home, Mariam finds her mother has hanged herself. Mariam temporarily stays with Jalil, but is quickly married off to Rasheed, a widowed shoemaker from Kabul thirty years her senior, and moves with him to Kabul. Rasheed is initially kind to Mariam, but after she becomes pregnant and miscarries multiple times, their relationship sours and he becomes increasingly abusive to her over her inability to bear him a son.
Meanwhile, Mariam's young neighbor Laila grows up close to her father, Hakim, an educated school teacher, but worries about her mother, Fariba, who experiences poor mental health following the death of her two sons fighting for the Mujahideen against the Soviets. Laila is close to Tariq, a local Pashtun boy with one leg, and as they grow older a romance develops between them. When Afghanistan enters civil war and Kabul is bombarded by rocket attacks, Tariq's family decide to leave the city, and Laila and Tariq have sex prior to his departure. Shortly afterwards, Laila's family decide to also leave the city, but before they can, a rocket hits their home, killing Hakim and Fariba and injuring Laila who is then taken in by Mariam and Rasheed.
As Laila recovers from her injuries, Rasheed expresses a romantic interest in her, much to Mariam's dismay. Laila is also informed that Tariq and his family died in a bomb blast on their way to Pakistan. Upon discovering she is pregnant with Tariq's child, Laila agrees to marry Rasheed to protect herself and her baby, whom Rasheed believes to be his. When she gives birth to a daughter, Aziza, Rasheed rejects them due to her being a girl. Mariam, initially cold and hostile towards Laila, warms to her as they both suffer abuse. They become confidants and formulate a plan to run away from Rasheed and leave Kabul; however, they are caught and severely punished by Rasheed.
The Taliban rise to power in Kabul and impose harsh rules on the local population, severely curtailing women's rights. Laila is forced to give birth to a son, Zalmai, via a Caesarian section without anaesthesia due to the women's hospital being stripped of its supplies. Laila and Mariam struggle with raising Zalmai, whom Rasheed dotes on and favours over Aziza, causing difficulties in managing Zalmai's behaviour. During a drought, Rasheed's workshop burns down, and he is forced to take other jobs. Due to a lack of food, Rasheed sends Aziza to an orphanage. Laila endures a number of beatings from Taliban when caught travelling alone to attempt to visit Aziza when Rasheed refuses to accompany her as her guardian.
Tariq appears at the family home and reunites with Laila, who learns Rasheed hired a man to falsely claim that Tariq had been killed so that she would agree to marry him. When Rasheed returns home from work, Zalmai informs Rasheed that Laila had a male visitor. Suspicious of Laila and Tariq's relationship and suspecting he is Aziza's real father, Rasheed beats Laila and attempts to strangle her; Mariam strikes Rasheed with a shovel, killing him. She tells Laila and Tariq to leave with Aziza and Zalmai, and confesses to the Taliban to killing Rasheed, for which she is publicly executed.
Laila and Tariq leave Afghanistan and move to Murree, Pakistan, where they get married. After the fall of the Taliban, they decide to return to Kabul to be present for the rebuilding of Afghan society. They stop en route to Herat, where Laila visits the village where Mariam was raised. She meets with the son of a kindly mullah who taught Mariam, who gives her a box Jalil had entrusted to the family to care for and give to Mariam should she return to Herat. The box contains a videotape of Pinocchio, a small sack of money, and a letter, in which Jalil expresses regrets at sending Mariam away, wishing he had fought for her and raised her as his legitimate child. The family return to Kabul and use the money to repair the orphanage Aziza had stayed in, and Laila works there as a teacher. She becomes pregnant with her third child, whom she will name Mariam if it is a girl.