We present a mathematical model of underground leaching by solutions filtering through a porous medium. The model describes the motion of solutions from injection to extraction boreholes, as well as dissolution and secondary deposition in reduced-pH regions. A numerical algorithm has been developed for solving the problem on a plane in the general case of a homogeneous medium that contains regions with various nonhomogeneities. The algorithm combines triangulation of the region with the finite element method. The model also allows slow variation over time of some of the process parameters, such as porosity and the filtration coefficient. Numerical results are reported for various cases. The model qualitatively describes the main regularities of underground leaching and can be used to study and understand the detailed dynamics of these processes. The model also fills gaps in geological prospecting data, and extraction curves constructed for different wells can be applied to determine the approximate location of a particular nonhomogeneity. Mathematical modeling can help to optimize mineral extraction by underground leaching.