'Your hair wants cutting,' said the Hatter. He had been looking at
Alice for some time with great curiosity, and this was his first
speech.  'You should learn not to make personal remarks,' Alice said
with some severity; 'it's very rude.'  The Hatter opened his eyes
very wide on hearing this; but all he said was, 'Why is a raven like
a writing-desk?'

LEWIS CARROLL himself proposed an answer in the 1897 final revision
of Alice's Adventures. "Because it can produce a few notes, though
they are very flat; and it is never put with the wrong end in front!"
The early issues of the revision spell "never" as "nevar", ie "raven"
with the wrong end in front.

Martin Gardner, in More Annotated Alice (1990) gave two possible
answers, sent in by readers: "both have quills dipped in ink" and
"because it slopes with a flap".