In ancient times, people believed that evil spirits could do harm to infants. They also believed that these evil spirits were allergic to certain colors, especially blue. Since blue was the color of the Heavenly sky, it was the color that was supposed to make evil spirits powerless and drive them away.
This belief in the powers of “blue” still exists in some parts of the world today. In the Middle East, Arabs often paint the doors of their houses blue to frighten away demons. They also dress young children in blue to protect them from these evil forces.
During all these times in history, female babies were considered inferior to males, so people never bothered to assign a special color to protect them. It was only in later years that parents decided that girls shouldn’t be neglected, so they gave them pink.