Well, alot of people have known about the eight gates. For someone to know that the eighth gate kills you it means that there's a possibility that someone has opened it.
But Madara was smart, experienced, and knew a fast majority about ninjutsus. It's really no suprise that he'd have information on something as well known as the eight gates