In political theory, the state is a tool of oppression by one social class over another. It is a product of the class struggle, created naturally as classes emerge in human history, to ensure the power of the ruling class can be protected.
Therefore, the state is a creation of material conditions and it follows then that it has not always existed and will not always exist as material conditions transform.
The state is a product of a society at a certain stage of development, when the means of production are sufficiently advanced for classes to emerge. For most of human history, societies were stateless as the material conditions did not allow for social classes to emerge and for one to subjugate the other; chiefly because there was very little surplus value to appropriate from the workers.
As the state seeks to assert the supremacy of one class over another, it functions to solve fundamentally opposed class interests. For example, it is in the interest of the bourgeoisie to exploit as much surplus value from the proletariat as possible (increasing their profits), and it is in the interest of the proletariat to surrender as little surplus value as possible (increasing their wages). The state functions as a tool of reconciliation of the contradiction, though it can never solve it (as it would require the abolition of class society entirely).
The state encompasses more than the sociological life and lives in all aspects of its citizens. The police, the military, the political system, the mode of production, the laws that are adopted and the institutions that follow from those laws... all are part of the state and serve to assert the will of the ruling class. Schooling for example, which has generally been made obligatory to some extent during the industrial revolution, serves a need to the mode of production: passing information over text is much more efficient when running a factory than over voice. Therefore, all workers are expected to be able to read (instructions on their machines, new directives from the directors, etc). Yet, if schooling is important to perpetuating the mode of production (which benefits the ruling class), it is the government that pays the costs. The state therefore perpetuates the ruling class' needs and ideals.
There exist today still stateless societies, in the form of tribes in some parts of the world. In these societies, there is no concept of private property or personal property to the extent we see in capitalist societies. The means of production are shared between all members, and the surplus value from the resulting production is mostly shared equally between all. The Namal people of Vanuatu, for example, craft their hunting weapons for the benefit of the collective, which the men and children will use as a group for their daily hunts in the surrounding forest. The resulting catch from the hunt is then cooked in the village and shared equally according to everyone's needs.
Dictatorship of the Proletariat
In Marxist theory, the question is then not what to do with the state, but who must control the state. This leads to the Dictatorship of the Proletariat, where the proletariat as a class (and not as individuals necessarily) control the state so as to oppress the bourgeoisie, much like the bourgeoisie has been oppressing the proletariat for centuries.
Withering away of the state
The state will naturally wither away as contradictions are resolved. If there is no need for a certain branch of the state to operate, that is if there is no basis in the material conditions, then it will not exist. This is naturally exemplified in capitalist society, for example as the ministries of colonies were dissolved after the colonial period, to name just one. If all contradictions in society are resolved, then it follows that the state itself will dissolve over time, ultimately resulting in a stateless society free from oppression and exploitation.