I also understood it to be about heresy, false teaching.
The Jews would teach morality and doctrine in the Name of Yahweh, but there were often false prophets who sprang up teaching novelties and falsehoods. They would also take the Name, but in vain. Therefore, to teach error is to take the Name of the Lord in vain. This seems to be a minority interpretation now, and I believe it is even omitted from the Catechism.