Does it happen if you try to run/walk when not on the treadmill? If so then definitely consider seeing the doctor.
It could be the treadmill, If the belt is slipping slightly then it can make you a bit unbalanced. This can cause problems particularly if, you favour one leg over the other.(perhaps because of 'poor' running technique or your anatomy, or a previous injury)