usually a few weeks if he is a coltish lad. if he hasnt shown any coltish behaviour and been out with the girls pre op then no problem, vet is your best adviser. i never turn mine out in mixed sexes, you not got a gelding he could go with?
He'll still be fertile for a couple of weeks. But if he's never show any interest in the mares before there should be no reason why he will afterwards.
He will become infertile immediately, vets tell people to keep them away from mares so as to limit any strenuous exercise until full healing has occured. Telling them he will still be fertile is the best way of getting people to follow advice.