There is not much information given about homeschooling in the books. However, there are several possibilities as to how homeschooling would not be in contradiction to the law against underage magic.
First, we know that underage wizards are allowed to use magic in Hogwarts (though even then there are limitations). That means that the law prohibiting underage magic is not all-encompassing; rather there are circumstances in which it is allowed (without even getting into emergency circumstances such as Harry fighting off dementors). Given that an exception is made for Hogwarts, it is possible that an exception is made for homeschooling as well. This exception, if it exists, would probably not be carte blanche. For all we know the parents/guardian would have to file specific Ministry applications to receive a permit to allow their students to use magic at home.
Another possibility is that homeschooled children are actually not allowed to use magic. We know from Chapter Twelve of Order of the Phoenix that there was at least one point when the Ministry's position was that magic could be learned without being performed:
“Your hand is not up, Mr. Thomas!” trilled Professor
Umbridge. “Now, it is the view of the Ministry that a
theoretical knowledge will be more than sufficient to
get you through your examination, which, after all, is
what school is all about. And your name is?” she
added, staring at Parvati, whose hand had just shot
“Parvati Patil, and isn’t there a practical bit in our
Defense Against the Dark Arts O.W.L.? Aren’t we
supposed to show that we can actually do the
countercurses and things?”
“As long as you have studied the theory hard enough,
there is no reason why you should not be able to
perform the spells under carefully controlled
examination conditions,” said Professor Umbridge
“Without ever practicing them before?” said Parvati
incredulously. “Are you telling us that the first time
we’ll get to do the spells will be during our exam?”
“I repeat, as long as you have studied the theory hard
Given that the Ministry would have no real way of enforcing that homeschooled children don't use magic, it is certainly possible that they would end up actually performing magic as part of their schooling; the point is, though, that homeschooling would be legal because in theory it can be done without using magic.
Taken one step further, it is even possible that the Ministry allows homeschooling even if performing magic was necessary for learning. The Ministry might assume that children living in Wizarding homes will anyway be doing magic (since the Ministry can't detect it) so allowing them to be homeschooled would not really be making matters much worse.