This is a form of OCD referred to as symmetry. When people with OCD have symmetry concerns, they want things to be even or balanced.
Therefore, they may do things an even numbers of times, they may walk in and out of doors twice to enter a room with both their left and then right feet first, or they may want to be sure that if one side of their body was touched, the other side gets the same touch.
Some individuals with symmetry OCD have gone to the point of injuring the non-injured side of their bodies so that they could have symmetrical pains or scars.
Symmetry compulsions can be driven by obsessions (if I do not do this in balance, my life will be out of balance), or it can just be a compulsive behavior that people develop, something that just feels as if it is the right way to do things.