If a dog walks on only three legs, it's usually because there's something wrong with its fourth leg. It could be due to injury, fracture, joint disease, nerve problems, or other health issues. Some dogs can only walk on three legs because they are born missing one leg or have some deformities at birth.
However, this situation is relatively rare. Whatever the case, if your dog walks on only three legs, you should take him to the veterinarian as soon as possible for examination and treatment so that the problem can be found and corrected. At the same time, you can also consider using some assistive equipment, such as a dog-specific wheelchair, to help it move and live better.