This is 20th century Cockney rhyming slang. It was first used as a slang term for engineer and led to the Engineering Corps of the Australian Army being called the Ginger Beers. Since around 1920 it has also, and now largely, been used as rhyming slang for queer.