Production
The film was produced by Nostromo Pictures, Atresmedia Cine, and Filmayer. Written by the director Oriol Paulo alongside Guillem Clua and Lara Sendim, the screenplay of God's Crooked Lines is the second film adaptation of Torcuato Luca de Tena Brunet's 1979 best-selling novel Los renglones torcidos de Dios, after Tulio Demicheli's 1983 Mexican adaptation Los renglones torcidos de Dios. Production began when Atresmedia Cine and Warner Bros., who had the rights to the novel, approached Paulo in June 2019, when he was about to start filming The Innocent. He had read it when he was 14 years old after his grandmother, an avid reader of mystery novels, recommended it to him. Paulo was initially hesitant to accept the offer because the novel had a universe that was too broad for him. His approval of their offer came six months later after rereading the novel and developing fascination with the main character, Alice Gould, whom he described as an "upper-class woman, so brutal, so intelligent and with such a verbal argumentative ability."
Paulo worked with co-screenwriter Guillem Clua to make improvisations on the story and adapt the novel into a film. They had to make the audience fit in with the 1970s environment of the novel, such as by making the language sound more contemporary, and eliminate parts of the novel that they found unimportant. The practice of insulin shock therapy, which is in the novel, was replaced by electroconvulsive therapy due to its cruelty; besides, it was already considered so even in the times of its publication. Paulo said that the film could have been a horror or a social drama, but he was requested to make it a psychological thriller because of his interest in the genre. Along with co-producer Ángel Blasco, he collected information about Torcuato from the author's family and met several psychiatrists for advice and supervision on the script. In order to understand what sanatoria were like in the 1970s, photographs from archives and film libraries were used.
The lead actors are Bárbara Lennie and Eduard Fernández. Lennie, whose mother was one of the psychiatrists to whom the production team consulted, played Alice Gould. It is the character of a woman who enters a mental institution by claiming that she is investigating a crime that has happened there. Paulo stated that while rereading the novel, he visualised Lennie in the role of Alice, whom he found having many qualities that the character has, among which are intelligence and mental agility, and being the only suitable actress to play it. She read the novel for a week and agreed to star in the film in September 2020; he immediately thought of Fernández as her co-star. Fernández portrayed Samuel Alvar, the director of the psychiatric hospital, and prepared himself by conversing with psychiatrists. Paulo described the pair as "two forces with a lot of egoism, a lot of character and who bring the tension of the book to the screen." Newcomer Samuel Soler played the dual roles of Rómulo and Remo, and digital effects were used to make it possible.
The production team watched several old films for inspiration on how a film was shot back then, including Shock Corridor (1963) for the rain scenes. With a budget of €7 million, the filming lasted for nine weeks, starting in May and ending in August 2021. It was shot in several locations in the provinces of Tarragona and Barcelona, including Terrassa, with Bernat Bosch as the cinematographer. The old Tabacalera building built in 1923 in Tarragona and a former Mercedes car plant in Barcelona were used to portray the psychiatric hospital. They respectively stood in for the hospital for the outdoor and indoor scenes. Antonio Valcárcel was the costume designer; describing his part as "one of the most satisfying jobs of his career," he had to design clothes that would match the high-class sphere to which Alice belongs and also the austerity of the 1970s psychiatric centre, which required him and Paulo considerable investigation owing to the scarcity of documentation at the time. Fernando Velázquez worked as a composer, whereas Jaume Martí was responsible for film editing.