Although there are certainly exceptions -- and when the time comes, you'll probably know if your child is one -- I think most two-year-olds aren't yet at an age where they associate the things you see on the Haunted Mansion with things to fear. The things that frighten a child of that age, in my experience, tend to be things like the idea of being separated from a parent or perhaps animals that might be threatening. My first child, when he was a two-year-old, rode it with no problem -- in fact, he wanted to ride again later when we passed it, so we did. A year or 18 months later, however, he would have none of it and nearly got hysterical as we approached the place. Now he's five and can't wait to ride it again every time we go.
A tip we learned that might help with children who are a little skittish and might be on the borderline between riding or not -- try to make your first attempt to ride it take place during daylight hours. The exterior doesn't seem so foreboding when the sun is shining.
Scott