Foals are not uncommonly born either bow legged or knock kneed. In fact, newborns are normally one or the other, but they rapidly grow out of it in most cases.
Crooked limbs are more common in twins or premature foals. In some cases the problem is not congenital, but is caused by a play injury or nutritional imbalance. Knock kneed is the most common. Some minor angular limb problems - back at the knee and toeing out are common - can't be corrected but, fortunately, have less of an effect on the animal's problems.
Both knock knees and bow legs are treated the same way. Very minor cases are treated by trimming the hooves in a way which encourages the legs to grow straight. Therapeutic glue-on shoes are also sometimes used. Some foals respond well to physical therapy (I personally don't fancy giving that to a rambunctious foal, but...)
In extreme cases, surgery might be needed - generally periosteal stripping, which is routine and has a very high success rate as long as it's done before the growth plates start to close, setting the legs in their crooked position. This usually means before the foal is three months old. The surgery involves cutting part of the tissue that protects the bone on the "tight" side, which encourages extra growth on that side for the few weeks it takes the periosteum to grow back.