On what grounds can a democratic state interfere to prohibit or limit its citizens from producing, distributing and consuming pornography? Does the state have any right to prohibit pornography or would it rather be violation of basic liberties of individuals? Under what circumstances prohibiting pornography can be justified?
Some of the answers to these set of questions you raised reside on Mill's principle of harm. According to this principle, the state can rightfully exercise its power over any citizen in order to prevent harm to others. So, if pornography causes harm to others, it follows, such principle could be justly activated. Another principle sometimes made use of is what may be called legal moralism, and yet another is what may be called legal paternalism. According to the latter, the state can rightfully exercise its power over any citizen in order to prevent him/her from harming themselves; and according to the former, the state can rightfully exercise its power over any citizen in order to protect what is plausibly assumed to be standards of community morality.
There seem to have been consensus that pornography involving children - either as acts or as consumers - should justly be prohibited. But the question of whether censorship of pornography may be justified in the case of consenting adults has portrayed disagreements. Moral Conservatives, for instance, contend that the state should prohibit pornography as part of its responsibility for its citizens. They advocate legal moralism and legal paternalism. Liberals on the other hand perceive pornography as a manifestation of freedom of speech and advocate the principle of harm - the only grounds that may be legitimate for state limitation on individual's freedom is in order to prevent harm to others. Feminists too voice their position. Some feminists, e.g. Catharine MacKinnon, argue that pornography should be justly prohibited as it violates women’s civil right (of equality); it is a political practice defining the treatment and status of all women, establishing them as inferior to men. Yet other feminists contend that pornography rather liberates women and assists in establishing gender equality.
Though user @JordanS has delivered an excellent, well-informed synoptic answer, more can be said.
First, the question is appallingly American, by which I mean historically provincial. The state can prohibit pornography or anything else because it is "the state." The "state" is not to be confused as an entity with the government, the people, the nation, the economy, the history... or all the other systems that fall vaguely under the false identity "america."
The "state" is not necessarily responsive internally to its citizens. It is responsive externally to other "states." To perserve itself it must continually adjust its internal relations. This includes, above all, the distribution of information. For example, the "financial" information on your computer enjoys different, and usually stricter, legal protections than the "sexual" information on your computer.
This is quite reasonable. As a "financial" or "sexual" being you are never an isolated individual. You exist only in relation to others. The state, for better or worse, will configure these relations, and they will evolve. Unless you are a confirmed solipsist, you have no absolute "right" to privacy... or to anything else. Your "rights" will evolve in relation to your dependence upon the state, which is typically absolute.
However, I must add that a small minority of your fellow citizens do not depend on the state. The extremely wealthy live under an international regime and can select the legal or moral "rights" they enjoy in ways that wage-earners inside states cannot. This seems like a long way from your question about "pornography." But it is not. It concerns "rights" within "states." What is pornographic is the financial violation, or "rape," of the implicit social consensus manifested in the state.
Ideally speaking, a democratic government exists to enforce the will of the people, or at least a majority thereof. (This ideal is not very well fulfilled, but that is another discussion.)
If a majority of the people wants pornography to be illegal, the government can and should legislate and enforce this.
Of course, in most democracies the majority also wants freedom of speech. And these two popular wishes are in conflict.
To make the situation livable, the government should make clear laws defining what is and is not legal in the borderline cases. These laws should preferably be in accordance with what the majority thinks on the matter.
Some people will disagree with these laws. Some will think that they are too strict, and some will think they are too lenient. This is in the nature of democracy.
In some European jurisdictions democratic states can in fact send you to prison if you so much as draw pornography depicting children out of your imagination (no models) or even write such stories in the basement of your house and only for the "benefit" of your own (debased) "pleasure" in that basement, without said "works" ever leaving said basement or be "appreciated" by other persons. The laws do not specifically describe the above scenario but are so broadly worded such as the above scenario perfectly falls within the definition of the "child pornography" crime. Poses interesting "thought crime" philosophical questions as much as any of us would abhor such a person and find his "works" extremely offensive, sick and repugnant.
So I guess the way even the most democratic society can enact laws that from a philosophical, or perhaps even legal, point of view may appear technically problematic is to not enact them explicitly but allow these border cases to emanate out of the "penumbras" of not very precisely worded but obviously well-intended laws.