I've been mostly wearing heels the last few 5 6 months. I wore flat shoes a couple of days ago and it hurt after a walking/standing. Whats wrong?

Changed the stress. Wearing heels over a prolonged period of time creates a muscle/tendon memory pattern- meaning these soft tissues are used to being in a certain position. Then, when you change to flats, you have put these tissues in a new and uncomfortable position. One example is the achilles tendon area. When wearing heels, you take tension off the tendon/calf muscles, and then going to flats stretches these.
Where is the pain. Heel, achilles tendon? Sometimes a flat shoe can over stretch and aggrevate the achilles or heel ligament if it has been used to a more contracted position (wearing heels)... Need more info to really answer the question though.