A finite element algorithm combined with divergence condition was presented for computing three-dimensional(3D) magnetotelluric forward modeling. The finite element equation of three-dimensional magnetotelluric forward modeling was derived from Maxwell's equations using general variation principle. The divergence condition was added forcedly to the electric field boundary value problem, which made the solution correct. The system of equation of the finite element algorithm was a large sparse, banded, symmetric, ill-conditioned, non-Hermitian complex matrix equation, which can be solved using the Bi-CGSTAB method. In order to prove correctness of the three-dimensional magnetotelluric forward algorithm, the computed results and analytic results of one-dimensional geo-electrical model were compared. In addition, the three-dimensional magnetotelluric forward algorithm is given a further evaluation by computing COMMEMI model. The forward modeling results show that the algorithm is very efficient, and it has a lot of advantages, such as the high precision, the canonical process of solving problem, meeting the internal boundary condition automatically and adapting to all kinds of distribution of multi-substances.