It's a train metaphor. Electric trains, like any other trains, have 2 rails the wheels go on. But there's a 3rd rail from which the train draws power. Touching it is death.
It was a common metaphor to describe Social Security reform years ago as people realized the system was headed for "bankruptcy". At least that's what they called it. In reality it was just that outgoings would exceed receipts by the 2030s, which means funding it from general revenue or reducing benefits.
But anyone who suggested "reforming" Social Security, such as private retirement accounts replacing it, tended to die a horrible political death and thus the third rail.
The other third rail I can think of is eliminating free street parking in NYC.