Gajet's answer does an excellent job of covering the '2d' case, where your ball moves in one dimension; if you want to roll it across a plane then things get decidedly more complicated, but still very manageable.
Here the ball is rolling across a plane in the direction of the green arrow, with (instantaneous) velocity V; the rotation is around the axis of the red arrow, and the normal to the plane is represented by the blue arrow (N). The instantaneous axis of rotation can be found by finding the cross product of the velocity vector with the normal vector, R=VxN; by combining this with something like Gajet's method (using Vt as the amount moved, where t is the time from the last frame to this one) you can construct a quaternion q representing the rotation the ball underwent over the course of the frame: basically, normalize your axis-of-rotation vector R to get R_n, find the amount of rotation Theta as Vt/2*pib, where b is the ball's radius, and build the quaternion q=(Rsin(Theta/2), cos(Theta/2)). Then you can compose this quaternion with the ball's previous rotation to get its new rotation.
But be careful - for most rolling-ball style games, this approach is actually exactly backwards! For instance, if you determine your ball's rotation by how far it's moved in contact with the ground, then you'll never see any 'spin' in the ball while it's in the air. Instead, I've found it works better to go the other way: keep track of your ball's angular velocity, have the player's controls actually (behind the scenes) control that angular velocity, and then while the ball is in contact with a surface, use the presumption that you're rolling without slipping to 'unroll' the motion like in Gajet's diagram and figure out where your ball ought to move to next frame. This gives you better physics because it gives you the option to roll with slipping, or to spin along the ground, or a number of other subtleties.