Keller Dover (Hugh Jackman), a deeply religious man who runs a failing carpentry business, attends a Thanksgiving dinner with his family at the house of neighbor and family friends the Birches. The families' six year old daughters, Anna Dover and Joy Birch, go for a walk outside with their older siblings, Ralph Dover and Eliza Birch. The children have to be forcefully pulled away from a parked white RV by their siblings when they start climbing on it. After dinner, the younger daughters leave to go back to Anna's house to get her safety whistle she is supposed to carry at all times, but they never come back.
Detective Loki researches past unsolved missing children's cases. One is Barry Milland, a boy missing since age 6, 26 years ago. Interview with his mother shows her playing and replaying a movie tape of him just before his abduction.
After a police hunt, the white RV is found parked outside a gas station next to a wooded area. When Detective Loki (Jake Gyllenhaal), who heads the case, goes to confront the RV's driver, Alex Jones (Paul Dano), Alex panics, tries to speed away, and crashes into the trees.
Alex is taken in for questioning, but it is found that he has the IQ of a 10-year-old and rarely speaks. The RV shows no forensic evidence indicating the girls were forcibly taken into or struggled inside the RV, and Alex's low intelligence means he couldn't have covered up such evidence. Also, polygraph tests of him prove inconclusive due to his low IQ, and he repeatedly denies ever having seen the children. Detective Loki goes to see Alex's aunt, Holly Jones (Melissa Leo), who raised him with his uncle after his parents died when he was six. Alex's uncle left the home a couple years ago after a domestic dispute with his aunt. Alex spends most nights sleeping in the RV and does not have many things. As the police are unable to find evidence against Alex, he is released in two days. Keller attacks Alex in a parking lot where he hears Alex say "They only cried when I left them." Though no one is close enough to hear this to corroborate, but Keller takes this as proof that Alex took the girls.
That night, Keller abducts Alex at gunpoint while walking his dog, and imprisons him in an abandoned, run-down apartment building that his father owned. With the reluctant help of Joy's father, Franklin Birch (Terrence Howard), Keller repeatedly beats Alex for 5 days for information. Overcome with guilt, Franklin tells his wife Nancy (Viola Davis) what they have done and brings her to see Alex. While talking to him, she unties Alex and he attempts to escape. Keller decides to build an enclosure around a bath tub in which he nails Alex. It is devoid of light except for a small PVC tube talk-hole. Keller tortures Alex with alternating scalding and freezing water from the showerhead. At this point, the Birches decide they cannot participate any longer, but they do not stop Keller or release Alex. Detective Loki begins tailing Keller after learning that Alex went missing, and eventually finds the apartment complex, though he does not discover Alex.
Over the days Alex is being tortured, Detective Loki interviews sex offenders within a 10 mile radius of the girls' homes. Loki discovers that Father Patrick Dunn has a bound and mummified body in his basement. Father Dunn claims that he did not know who the man was, but that in confession the man talked about killing sixteen children and also admitted to having a marital dispute. Father Dunn confesses that he convinced the man to come to his house, where he killed him "to save the children" and is arrested for murder. The body is wearing a circular medallion with a maze design. The body is not identified by DNA or missing persons' reports.
During a candlelight vigil for the missing girls, Detective Loki notices a man acting suspicious, but loses him in a chase. Subsequent scenes show the man (Bob Taylor) breaking into the Dover and Birch homes, though it is not revealed what he did there. Keller's wife hears the window open when the man breaks in, but never sees him, and believes Anna had come back. Detective Loki writes down her statement of someone coming in through the window. After a sketch of the man appears on the news, a discount store clerk recognizes him and states that he comes in from time to time to examine children's mannequins and buy children's clothing. The clerk gives Loki the man's license plate to track him down. The man is Bob Taylor. Loki confronts Taylor at his home and finds that the walls are covered in drawings of intricate mazes. In a back room, locked crates filled with maze books, venomous snakes, and bloody children's clothing are discovered. Both the Dovers and Birches identify clothing belonging to their children from the crates, and Taylor confesses to killing them. Keller begins to regret his actions towards Alex, but still believes Alex may know where the bodies are. Alex mentions a clue about finding the girls in a maze. Keller goes to the Jones home to "apologize" to Holly for attacking Alex at the police station, but in reality, he is there to judge her reaction when he mentions he's having dreams of Anna in a maze.
Believing there's a small chance the children might still be alive, Loki loses emotional control and beats Taylor during questioning. Taylor manages to grab one of the officers' gun from his belt and commits suicide. The blood on the children's clothes is later found to be pig's blood, and after looking back at Keller's wife's statement about the window, Loki realizes that Taylor had stolen the clothing from the girls' rooms. Taylor is revealed to be a fake killer copying a book titled "The Invisible Man" which prominently features mazes, especially a circular maze (seen in the "O" in the "Prisoners" logo and as the maze medallion worn by the body in Father Dunn's basement) which Taylor was drawing while in custody.
Days later, Joy Birch is found wandering, drugged and is hospitalized. Anna remains missing. In her drugged state, Joy rambles that Keller was there, giving the audience the impression that Keller is somehow in on it. Keller rushes off as Loki chases him. Loki loses Keller, but heads towards Keller's father's unoccupied apartment building and discovers the imprisoned Alex.
Keller goes to Holly's, realizing that is where Joy had heard him. Holly holds him at gunpoint and forces him to put on handcuffs and consume the same sedative used to drug Anna and Joy. She reveals that she and her husband had been religious people, like Keller, until their son died of cancer at a young age. Holly and her husband decided to make a war on God by making children disappear without a trace to turn their parents into demons, as evidenced by what Keller had become. Alex Jones (actually Barry Milland) was the first child they abducted and they raised him as their own son. They abducted Bob Taylor then released him and allowed him to live. Taylor is obsessed with recreating his abduction by stealing children's clothes, pouring pig's blood on them, and hiding the clothes in trunks with snakes. Holly tells Loki that Alex has a fear of snakes because of a childhood incident.
Holly and her husband abducted and killed children together until her husband left home one day and never returned. From that point on, Holly stopped killing children as she needed her husband's help. However, when Alex gave Anna and Joy a ride in the RV for their amusement, Holly tells Keller she decided the girls would never leave her home. That is when the girls cried when Alex left them with Holly. Keller realizes that Alex never harmed the girls. Holly shoots Keller in the leg and dumps him handcuffed in a pit hidden under a functional car made to appear broken and disused. This pit is where she had made all the kidnapped children "disappear". However, she mentions having moved Anna and Joy into the house when the police started looking around, which is what allowed Joy to eventually escape. In the pit, Keller finds his daughter's whistle, and begins to attempt to repent for the demon he had become.
Flashback of Anna and Joy sedated in the house shows them with a maze book with a sign taped to the cover "when you finish this you can go home" apparently Holly and her husband forced abducted children to try to solve the unsolvable mazes as a condition of release. It explains the obsession with mazes of Bob Taylor and the reference to finding the girls in the maze made by Alex. Later the detectives at Bob Taylor's home discuss the circular labyrinth maze as being unsolvable, there is no way out, and an essential part of the graphic mystery The Invisible Man Bob Taylor plays out and draws in his fantasies. Labyrinths are religious mazes. Bob Taylor is unable to find his way out.
Detective Loki goes to Holly's house to tell her about Alex being found. He enters the home when he hears noises but she does not respond to his knock. Loki sees on the dresser a photo of Holly's husband wearing the round maze medallion and realizes that her husband is the body in Father Dunn's basement and that Holly and her husband must have killed at least 16 children. Loki confronts Holly as she is injecting Anna with lethal dose of sedative. The two shoot each other; The bullet grazes Loki's right forehead, and Holly is killed. Loki rushes Anna to the hospital. Anna detoxes while Loki recovers from the gunshot wound to the head.
Days later Keller remains missing, and is assumed to be on the run to avoid arrest for his imprisonment and abuse of Alex. Grace assures Loki that Keller has not contacted her. Loki promises Keller's Wife he'll find him. The newspaper reveals that Alex Jones is actually Barry Milland the 6 year old who was kidnapped from the mother Loki visited earlier in the film. Loki is later shown with a team excavating Holly's yard. The frozen ground dramatically slows the search. . After the team leaves, Loki is left alone, seemingly pondering Keller's whereabouts. He hears a faint whistle, but believes it to be his imagination. However, he again hears the faint sound of Keller blowing a whistle in the hidden pit, and Loki turns around to investigate.