This was explained in the novel and was planned to be explained in the film, but the scene was cut for time. Here's a summary from /Film Trivia: Why Was the Triceratops Sick in ‘Jurassic Park’?
In the film we learn that the Triceratops is getting sick every six weeks or so. Dr. Ellie Sattler first believes the culprit may be the West Indian Lilac berries found nearby, but she is told that the dinosaurs don’t eat the poisonous berries. We don’t find out the answer in the film but the event is also in the Michael Crichton novel and thus we have an answer to the question of what made the triceratops sick. (In the book it was a Stegosaurus instead of a Triceratops, however.)
The triceratops digests food such as vegetables or fruit by also eating small stones that crush and mash the food in their stomach. In the original book upon which the film is based, we find out that the stones it eats are too close to poisonous West Indian Lilac berries. So when the dinosaur replaces the stones every six weeks it simultaneously picks up some of the fallen berries and is poisoned again.
It was mentioned at the end of the same article that this explanation for the dinosaur's illness was filmed, but didn't make the final cut of the movie.
Interestingly enough, while Spielberg didn’t have the time to answer the question in the film he does suggest the cause as we see Dr. Sattler crouch down by the Lilac berry bush and picks up some small stones, playing with them for a brief moment. This moment is apparently the remnants of a deleted scene which was filmed but never made the final film which would have explained the reason for the dino’s sickness.
You can read the deleted scene in the Jurassic Park Script (scene 44):
44 EXT PARK DAY
The skies are really foreboding now, and there's a sense of
growing urgency. ELLIE is by the animal, a short distance away from
the group. GRANT is near her, thinking.
Ellie, I've been thinking there's something about the
periodicity doesn't had up.
Tim holds one of the smooth rocks up and calls out, a little
These look kind of familiar.
Triceratops was a constant browser, and constant
browsers would be constantly sick.
Not just every six weeks.
Yeah, I know.
I've seen pictures of these!
Grant turns and looks at him, a little annoyed.
In your fully illustrated book.
Grant just rolls his eyes, but Ellie comes over and checks out
A light goes on in her eyes.
Alan - - gizzard stones!
She throws Grant one of the stones. They look at each other in
As before, when they get excited, they talk right over each
Elm that's it, it explains the periodicity, the - -
- - the undigested state of the berries because it's - -
- - totally incidental
unrelated to the feeding pattern - -
What are you guys saying?
(turning to Tim)
It's simple, see. Some animals like her, don't have
teeth - -
- - like birds - -
- - like birds. What happen is, they swallow the stones
and hold them in a muscular sack in their stomachs - -
- - a gizzard - -
- - which is called a gizzard, and it helps them mash
their food, but what happens after a while - -
- - what happens is that after a while, the stones get
smooth, every six weeks, so the animal regurgitates them
- - barfs them up - -
- - and swallows fresh ones.
And when she swallows the stones, she swallows the
poison berries too. That's what makes her sick.
Good work Tim.