In many branches of earth sciences, the problem of rock study on the microlevel arises. However, a significant number of representative samples is not always feasible. Thus the problem of the generation of samples with similar properties becomes actual. In this paper we propose a deep learning architecture for three-dimensional porous medium reconstruction from two-dimensional slices. We fit a distribution on all possible three-dimensional structures of a specific type based on the given data set of samples. Then, given partial information (central slices), we recover the three-dimensional structure around such slices as the most probable one according to that constructed distribution. Technically, we implement this in the form of a deep neural network with encoder, generator, and discriminator modules. Numerical experiments show that this method provides a good reconstruction in terms of Minkowski functionals.