There were three sets of Roman legislation relating to magic. There was an edict in the Twelve Tables (ca. 451 BC); the laws of Sulla (81 BC); and the legislation of Constantine and other Christian emperors (after 312 AD).
Table VIII.9 made it a crime to move crops from someone else’s field to one’s own by magic. There is another possible prohibition of a carmen causing insult to another, where carmen may mean a spell. The emphasis is on injury to another. A trial under this law took place before the curule aedile, Spurius Albinus, in 157 BC according to Pliny the Elder NH 18-41-43. Further actions against magicians, usually their expulsion, took place during the republic.
The Lex Cornelia de sicariis et veneficis (=assassins and poisoners) is quoted in the so-called Sentences of Paulus 5.23.15-18 (ostensibly ca. 210 AD; probably actually late 3rd century AD; does not seem to be online). This reads:
Persons who celebrate or cause to be celebrated impious or noctural rites so as to enchant, bewitch or bind anyone, shall be crucified or thrown to wild beasts… Anyone who sacrifices a man, or attempts to obtain auspices by means of his blood, or pollutes a shrine or a temple, shall be thrown to wild beasts, or, if he is of superior rank, shall be punished with death. … It has been decided that persons who are addicted to the art of magic shall suffer extreme punishment; that is to say, they shall be thrown to wild beasts or crucified. Magicians themselves shall be burned alive. … No-one shall be permitted to have books of magic in his possession, and when they are found with anyone they shall be publicly burned and those who have them, after being deprived of his property, if they are of superior rank shall be deported to an island, and if they are of inferior station shall be put to death; for not only is the practice of this art prohibited, but also knowledge of the same.
Digest 48.8 deals with this law, and quotes the opinions of later jurists on it. Among these are a quotation in 48.8.4 from book 7 of Ulpian’s De officiis proconsularis ; the same book of the same work which Lactantius tells us (Div. Inst. 5, 11) contained edicts against the Christians:
Moreover, most wicked murderers have invented impious laws against the pious. For both sacrilegious ordinances and unjust disputations of jurists are read. Domitius, in his seventh book, concerning the office of the proconsul, has collected wicked rescripts of princes, that he might show by what punishments they ought to be visited who confessed themselves to be worshippers of God.
It may be relevant that Christians were sometimes accused of practising magic; perhaps the edicts were gathered together for this reason.
Augustus as pontifex maximus ordered all books on occult subjects to be burned, which were 2,000 in number, according to Suetonius (Aug. 31). In AD 16 yet another expulsion of magicians and astrologers from Italy took place; and further expulsions occurred during the first century.
The legislation of the Christian emperors is in the Digest 9:18 and in the Codex Theodosianus 9:16. In 312 Constantine banned a haruspex from visiting another; in 321 banned magical arts that injured others, while exempting those used for medicinal purposes or the general welfare. In 357 Constantius banned magic altogether:
“Chaldeans, magicians, and others who are commonly called malefactors on account of the enormity of their crimes shall no longer practice their arts.”
A law of 358 called magicians “the enemies of the human race” and classified those who used magic verses, sorcerors, haruspices, soothsayers, augurs, diviners, and interpreters of dreams as magicians.
Although the Lex Cornelia involved a general prohibition, cases such as that of Apuleius show that only when harm was supposed was the law likely to become involved, and otherwise was not strictly enforced. Apuleius was accused of using magic to cause a boy to fall sick, and also to induce a wealthy widow to marry him (to the fury of her family, who raised the allegation). In his defence, Apuleius acknowledges the illegality of magic (Apology 47):
You have demanded fifteen slaves to support an accusation of magic; how many would you be demanding if it were a charge of violence? The inference is that fifteen slaves know something, and that something is still a mystery. Or is it nothing mysterious and yet something connected with magic? You must admit one of these two alternatives: either the proceeding to which I admitted so many witnesses had nothing improper about it, or, if it had, it should not have been witnessed by so many.
Now this magic of which you accuse me is, I am told, a crime in the eyes of the law, and was forbidden in remote antiquity by the Twelve Tables because in some incredible manner crops had been charmed away from one field to another. It is then as mysterious an art as it is loathly and horrible; it needs as a rule night-watches and concealing darkness, solitude absolute and murmured incantations, to hear which few free men are admitted, not to speak of slaves.
And yet you will have it that there were fifteen slaves present on this occasion. Was it a marriage? Or any other crowded ceremony? Or a seasonable banquet? Fifteen slaves take part in a magic rite as though they had been created quindecimvirs for the performance of sacrifice! Is it likely that I should have permitted so large a number to be present on such an occasion, if they were too many to be accomplices? 
Magic, then, was always something secret and illegal; if, in practice, tolerated so long as no scandal occurred.
1. Stephen Benko, Pagan Rome and the Early Christians, p. 128f.
2. Eugene Tavenner, Studies in magic from Latin Literature, p.13 f, usefully reviews all the data with references, and also lists Roman writers on the occult.
3. Apuleius, Apology, 47.
4. Digest is online in Latin here as part of the Corpus Juris Civilis.