To me, it seems the professor's primary point was that her choice to break the law would put her family at "risk" or otherwise inconvenience them. Frankly, an Objectivist would not care about this, and would certainly not let it dictate their morality.
Furthermore, an Objectivist would reject such a law as immoral. In "What is Capitalism?", Capitalism: The Unknown Ideal, Ayn Rand writes (emphasis added):
Capitalism is a social system based on the recognition of individual rights, including property rights, in which all property is privately owned. The recognition of individual rights entails the banishment of physical force from human relationships: basically, rights can be violated only by means of force. In a capitalist society, no man or group may initiate the use of physical force against others. The only function of government, in such a society, is the task of protecting man's rights, i.e., the task of protecting him from physical force; the government acts as the agent of man's right of self-defense, and may use force only in retaliation and only against those who initiate its use; thus the government is the means of placing the retaliatory use of force under objective control.
Objectivism advocates a sharply limited form of government, where the state has power only to take actions that are necessary to secure the rights and freedoms of the individual. This, it is held, is necessary in order to prevent excess governmental power from being turned against individual freedom and being used to restrict it.
Although an Objectivist would concede that the government needs to provide civil law (contracts, torts, etc.) as a positive service, this should be restricted by clear, objective standards. The laws must be based in "essential principles", by which is meant "grounded in the principles of individual rights."
Thus, since government's only function is to protect rights, and the law that you describe does not protect rights—and moreover serves to restrict an individual's free exercise of rights—that law would be on face immoral and you could not possess a moral obligation to follow it.
I think you will find Rand's essay "Man's Rights" (reprinted in The Virtue of Selfishness, as well as other volumes of her work) most illuminating of these views. Here is a relevant excerpt; you can read the full text online here:
“Rights” are a moral concept — the concept that provides a logical transition from the principles guiding an individual’s actions to the principles guiding his relationship with others — the concept that preserves and protects individual morality in a social context — the link between the moral code of a man and the legal code of a society, between ethics and politics. Individual rights are the means of subordinating society to moral law.
The most profoundly revolutionary achievement of the United States of America [in contrast to previous "statist" and "altruist-collectivist" societies] was the subordination of society to moral law.
The principle of man’s individual rights represented the extension of morality into the social system — as a limitation on the power of the state, as man’s protection against the brute force of the collective, as the subordination of might to right. The United States was the first moral society in history.
All previous systems had regarded man as a sacrificial means to the ends of others, and society as an end in itself. The United States regarded man as an end in himself, and society as a means to the peaceful, orderly, voluntary coexistence of individuals. All previous systems had held that man’s life belongs to society, that society can dispose of him in any way it pleases, and that any freedom he enjoys is his only by favor, by the permission of society, which may be revoked at any time. The United States held that man’s life is his by right (which means: by moral principle and by his nature), that a right is the property of an individual, that society as such has no rights, and that the only moral purpose of a government is the protection of individual rights.
A “right” is a moral principle defining and sanctioning a man’s freedom of action in a social context. There is only one fundamental right (all the others are its consequences or corollaries): a man’s right to his own life. Life is a process of self-sustaining and self-generated action; the right to life means the right to engage in self-sustaining and self-generated action — which means: the freedom to take all the actions required by the nature of a rational being for the support, the furtherance, the fulfillment and the enjoyment of his own life. (Such is the meaning of the right to life, liberty and the pursuit of happiness.)
The concept of a “right” pertains only to action — specifically, to freedom of action. It means freedom from physical compulsion, coercion or interference by other men.
Thus, for every individual, a right is the moral sanction of a positive — of his freedom to act on his own judgment, for his own goals, by his own voluntary, uncoerced choice. As to his neighbors, his rights impose no obligations on them except of a negative kind: to abstain from violating his rights.
That last paragraph in particular should really clench your understanding of why an Objectivist would take issue with a law like the one to which your professor alludes. It is inconsistent with the singular purpose of government, it is coercive to the individual in that it prevents her from exercising her own voluntary freedom of choice—to live her life as she sees fit. The state would be compelling the individual to act against her own judgment, and that would be intrinsically immoral. The government, even as it represents a collective of individuals, cannot thus force positive moral obligations upon its individual members.