Geiger installed it.
Geiger — as explained in the original novel — was a pornographer and blackmailer.
“Marlowe investigates Geiger's bookstore and meets Agnes, the clerk. He determines the store is a pornography lending library. He follows Geiger home, stakes out his house, and sees Carmen Sternwood enter. Later, he hears a scream followed by gunshots and two cars speeding away. He rushes in to find Geiger dead and Carmen drugged and naked, in front of an empty camera.”
Wikipedia - Novel
Due to the movie “Hays code” (Motion Picture Production Code) at the time, the reference to pornography was toned down to just “blackmail” and “gambling debts.”
A primary focus of the Hays Office censorship policies was to heavily restrict sexual themes. In the novel, Geiger is selling pornography, then illegal and associated with organized crime, and is also a homosexual having a relationship with Lundgren. Likewise, Carmen is described as being nude in Geiger’s house, and later nude and in Marlowe’s bed. To ensure the film would be approved by the Hays Office, changes had to be made. Carmen had to be fully dressed, and the pornographic elements could only be alluded to with cryptic references to photographs of Carmen wearing a “Chinese dress” and sitting in a “Chinese chair.” The sexual orientation of Geiger and Lundgren goes unmentioned in the film because references to homosexuality were prohibited.
So the above novel scene becomes…
Marlowe goes to Geiger’s rare book shop. Agnes Louzier (Sonia Darrin), Geiger’s assistant, minds the shop, which is the front for an illegal operation. Marlowe follows Geiger to his house, where he hears a gunshot and a woman scream. Breaking in, he finds Geiger’s body and a drugged Carmen, as well as a hidden camera empty of film.
Wikipedia - Movie
The camera was there to take compromising photos of people sat in that chair where Marlow finds Carmen.
You might notice that Carmen appears drugged in that scene, indeed Marlowe checks what she has been drinking and seems to indicate that this is the case.