First of all, the primary issue here is likely to be external (lateral) rotation at the hip, as your knee does not rotate much at all when the knee is straight. There's a number of reasons you could have this problem.
The most obvious would be a combination of muscle tightness and muscle weakness in the antagonist muscle group. A good strengthening and stretching regimen could help assist the biomechanics back to normal. Strengthen the internal rotaters and stretch out the external rotaters.
There could also be some physical changes to the bony structures of the involved joints (mainly looking at the hips and knees but at a stretch even ankles) that would lead to people adopting positions of ease causing issues like this, tough over time this would lead to the above changes also so both would need to be corrected.
A slight amount of external rotation is actually completely normal. The shin should align with the 2nd toe in standing iirc.
/physio student
Edit - There seem to be a lot of people confusing this with an issue with flat footedness. Flat foot is an a foot issue and unless very severe is unlikely to have much of an effect on the rotation of the hip, therefore it's a seperate issue. If you have very flat feet, you will get over pronation of the foot, very high arches will lead to over supination (much less common). Over pronation can lead to some appearance of external rotation, but you can very much be over pronated and also have perfectly normal hip rotation and therefore your feet wont point outwards as much. Overpronation can lead to a valgus deformity at the knees, however this would lead to an internal rotation at the hip, not an external rotation.
I may have got some of this stuff wrong, I'm still studying