I understand the risk of hitting an asteroid is small, but I'm wondering if there's a reason spacecraft usually stay on the main Solar System orbital plane.
First, space is absolutely gigantic; the chance of either of the Voyagers, or ay other outer-planet mission, hitting an asteroid was infinitesimal.
Second, the asteroid belt itself isn't really constrained to the ecliptic plane; plenty of asteroids have significant inclinations, so staying out of the ecliptic wouldn't guarantee safety.
Third, incorporating a significant inclination change into the Earth departure trajectory would have required a lot of additional performance; I don't know off the top of my head how much inclination could have been achieved given the maximum performance of the launcher and the mass of the Voyager spacecraft, but I don't think there was very much performance margin available.
Finally, the trajectories of the Voyagers' flybys of Jupiter were heavily constrained by the need to use Jupiter's gravity to slingshot on towards Saturn,. It's possible to incorporate an inclination change into a gravity assist maneuver (changing from the inclined Earth-to-Jupiter leg from the in-ecliptic Jupiter-to-Saturn leg), but doing so might have conflicted with other mission parameters.
A Keplerian trajectory in the Solar system essentially needs to be in a plane defined by three points: the location of the Sun, the location you're starting from, and the point your target will be at when your spacecraft arrives. Since planets are close to the ecliptic, this plane will usually be close to the ecliptic for an interplanetary mission.
Then consider that fuel is precious and changing planes using thrust requires a lot of fuel. The only practical way to get a spacecraft substantially out of the ecliptic plane is a gravity assist from a giant planet.
Thus, in practice, the only usable interplanetary trajectories are close to the ecliptic.
The asteroid belt is toroidal, the asteroids aren't confined to the ecliptic plane. This diagram from Wikipedia shows that most asteroids have orbital inclinations under 10°, but there are still significant numbers out to 20° or so.
This plot of orbital inclination ($i_p$) versus eccentricity ($e_p$) for the numbered main-belt asteroids clearly shows clumpings representing asteroid families.
Also from that article,
The orbital distribution of the asteroids reaches a maximum at an eccentricity of around 0.07 and an inclination below 4°. Thus although a typical asteroid has a relatively circular orbit and lies near the plane of the ecliptic, some asteroid orbits can be highly eccentric or travel well outside the ecliptic plane.
As the following diagram shows, the mean orbital radius for most main belt asteroids lies between 2.1 AU and 3.25 AU.
To go above (or below) the belt your spacecraft's orbit needs to have an inclination of at least 10°. But 10° at 3 AU puts you about 0.52 AU or almost 78 million km above the ecliptic, which is a rather significant detour, especially if your intended destination is close to the ecliptic plane. Such a detour represents a sizeable amount of orbital energy, and hence fuel consumption.
However, as already mentioned in other answers, such a detour is quite unnecessary. The asteroid belt is sparse. As Wikipedia says,
The asteroids are spread over such a large volume that it would be improbable to reach an asteroid without aiming carefully.
A typical estimates of the mean distance between asteroids is around 1,000,000 km (2.6× the distance between the Earth and the Moon), but that's for asteroids of diameter 1 km and larger. There are probably estimates for smaller bodies, but they aren't easy to find, although there's probably useful info in the articles linked at What is the average distance between objects in our asteroid belt?
There are regions in the asteroid belt with higher that average concentrations of grit and dust. It's probably a good idea to avoid them, if practical, but they don't pose a major hazard for typical spacecraft. According to veteran asteroid hunter Tom Gehrels of the University of Arizona, in this Scientific American article from 1997,
In some ways, the asteroid belt is actually emptier than we might like. In the early 1990s, the National Aeronautics and Space Administration wanted the Galileo spacecraft to encounter an asteroid while it was passing through the asteroid belt on its way to Jupiter. But it took some effort to find an object that was located even roughly along Galileo's path. Special targeting was required to reach this object, but the result was the first close-up view of an asteroid, the one called Gaspra.
The number of objects in the asteroid belt increases steeply with decreasing size, but even at micrometer sizes the Pioneer spacecraft were hit only a few times during their passage.