If fabric is in contact with wood for a long enough time, acids from the wood can leach into the fabric. I would use good quality shelf liner, or seal the wood with poly.
ETA: We made bookshelves last year and used polyurathane. Recommendation was that you wait 2 weeks before you put anything on the shelves, and 1 month before you put anything heavy, like books on them.