Suppose that the width $w$ and length $l$ are in rational proportion. That is, $r = \frac wl = \frac nm$ for some positive integers $m, n$, i.e., $nl = mw$. Also suppose that the slope of the initial line of travel of the ball is rational, say $s = \frac pq$ for integers $p, q > 0$ (if the original slope is negative, the picture can be flipped to make it positive).
If we "unravel" the path, we get instead a grid of $w \times l$ rectangles, and the path is now just a straight line. If the ball moves along that line from the starting point a distance of $qmw$ to the right, it will also move up by $pmw = pnl$. Because this is an exact multiple of the squares, the ball ends up in the same place it started, and heading in the same direction. So its future path is just repetitions of the path so far. The distance travelled per bounce will be the same for the entire path as for this first repetition.
For that first repetition, the distance travelled is $\sqrt{(qmw)^2 + (pmw)^2} = qmw \sqrt{1 + s^2}$. And the path crosses $qm + pn$ gridlines, or in the original view $qm + pn$ bounces (if the path intersects a vertex, that counts as a double-bounce). So the average distance per bounce is
$$\frac{qmw\sqrt{1+s^2}}{qm + pn} = w \frac{\sqrt{1 + s^2}}{1 + rs}$$
Treating that expression as a function of $s$, we see that it equals
- $w$ when $s = 0$
- $\frac wr = l$ when $s \to \infty$
as would be expected. Also, it has a critical point when $s = r$, where the average distance per bounce is $$\frac w{\sqrt{1 + r^2}} = \frac {wl}{\sqrt{w^2 + l^2}}$$
Because irrationals can be approximated by rationals to any desired accuracy, these three values will also be the limits more generally: The mean distance between bounces tends towards a value between the minimum and maximum values of $\left\{ w, l,\frac {wl}{\sqrt{w^2 + l^2}}\right\}$.