a red light as a sign to stop is from 1849, long before traffic signals; see red (adj.1) + light (n.). As the name of a children's game (in reference to the traffic light meaning) it is recorded from 1953.
The use of red-light district to indicate a city district with many brothels is by 1896.
On a few blocks east of the Bowery, in what was known as the Red Light district, there are still a few houses of this character. The Red Light district was so called because the hall light in disreputable houses had a red globe or shone through red curtains covering the transom of the hall door. A red light before a cigar store, cider room or coffee room indicated its purpose. The Parisian licensed brothel has a red lantern with the number of the house over the door. [I.L. Nascher, M.D., "The Wretches of Povertyville," Chicago, 1909]