A foal can be weaned anytime desired. In research at Ohio State, foals were weaned at 2-3 days and fed like dairy calves. The foals did fine, but feeding young foals is labor intensive. A mare's milk production peaks at 2-3 months, so a foal needs to be eating supplemental feed at that time. Normally foals are eating significant quantities of feed at 4 months and the mare's milk production is decreasing, so the foal can be weaned anytime after that. The normal recommendation is to wean at 4-6 months of age. The foal should be "on feed" and have a buddy to keep it company during the weaning process. Keep the foal in a safe pen or stall with its buddy until it accepts the loss of its mother.
