A 4 inch round sphere cannot pass through the guard
railing. There are some exceptions in some building codes, but as a
general rule of thumb a 4 inch round sphere shouldn't be able to pass
through any section of the stair guard railing. You don't need a 4 inch
ball, simply use your measuring tape to make sure that no areas of the
guard railing, including the balusters don't have any spaces that are
more than 4 inches.
The reason for the maximum 4 inch spacing in between the balusters and other stairway parts is to prevent small infants from getting their heads stuck in the stairway. When I first started working in construction, the building code requirement was 6 inches, but they were having problems with young children, getting their heads stuck in between the balusters. This force them to change the building code. When ever building codes change, there is probably a good reason behind it. Remember most of Building Departments (building code enforcers) are called Building and Safety Departments, for a reason.
Commercial and industrial buildings (no public) might require a maximum baluster spacing of 12 inches. I'm sure that the thought behind this building code has something to do with the fact that there wouldn't be unattended small children running around.
Attention: Don't forget to check with your local building department to verify any building codes on this website. This information could be incorrect or outdated. Building codes are updated regularly and to some building departments have different interpretations for certain building codes.