Many trains in Israel travel long distances.
I would like to know if there are restrooms on board all trains.
Trains in Israel are hardly long distance. The longest is an hour and a half, two at a stretch. And yes, they have restrooms, but you can always go out at a station, and take the next train, if there's a real problem:-)
Your ticket is valid for a travel, once you pass the gate at the entrance of the origin station, till you exit at the gate of your destination station (where you surrender the ticket). In between you're free to step in and out the trains as you wish, as long as you don't exit the interim stations. Public restrooms are generally clean.