Town boss Danny Wilson said: "David is a player I have tried to get for a while at a number of clubs, so I'm delighted he's joining us."
Lucas, who played for Preston, Scunthorpe, Sheffield Wednesday, Darlington and Barnsley before joining Leeds, made only 19 first-team appearances in his two years at Elland Road.
Leeds released him at the end of his contract.