The diet of Herbivorous animals has a lot of cellulose and they need to digest it and its digestion takes a longer time. The longer small intestine allows the complete digestion of the cellulose they eat.
Carnivorous lack an enzyme named CELLULASE and that is why they are unable to digest cellulose and have shorter small intestine.