Human nature tends to naturally distrust those things that are strange and unusual (hell, it is a fine evolutionary trait as it probably enhanced our survival ages ago). Sadly, we have trouble as a species keeping this trait from manifesting as racism.

I would actually commend Tolkien for treating the topic as realistically as he did. The story setting seems so much more alive and filled with depth when you read about characters acting in a fashion that makes them seem more real.

The thing to keep in mind though are the moments when Tolkien clearly put great stock in characters overcoming their inherent prejudices. The best example that comes to mind is the friendship between Legolas and Gimli. The sense I gather when reading it is that each is made better from their acceptance and bonding to each other. This is a positive message in the midst of a divisive context.