Interesting… I’ve sort of wondered a little bit of this as well.
huh
The whole thing was that nobody besides a very select few knew about the Horcruxes. So I doubt Lucius would have known about the diary. He probably knew it was dangerous in some dark magic way, and he’s still an asshole, so “accidentally” giving it to Ginny would have just been his way of harming the blood traitor Weasley family. If Voldemort had punished Lucius it might have made others wonder why which might have led them to discover the truth about the Horcruxes. As for how he got it in the first place, it was probably some sort of forgotten heirloom packed into boxes. Maybe he picked it up in Borgin and Burkes?
Aaaaaaaand with that I think I just out-nerded myself. Off to watch Harry Potter.
(Source: harrypotterconfessions)