Yes, direct sunlight is harmful to your washing machine. The extreme heat of direct sunlight can slowly damage the parts of a washing machine.
Furthermore, too much exposure to the direct sunlight can lower the lifespan of your washing machine.