The borehole-to-surface electromagnetic (EM) method is a viable imaging and monitoring tool for energy reservoirs, geologic storage, geothermal exploration, fault zones, and other subsurface targets. Data interpretation typically requires considering steel-casing effects, but it is difficult and impractical to directly discretize arbitrarily oriented hollow steel-cased wells in a 3D reservoir-scale earth model because of their extremely high electrical conductivity and long hollow geometry. We have considered a borehole-to-surface EM configuration in which an electric dipole source is placed below the bottom of a steel-cased well. To practically simulate the casing effects on EM measurements, we develop a novel 3D finite-element EM algorithm using an unstructured tetrahedral mesh. To avoid excessive use of fine grids for modeling a steel-cased well, the well is replaced with the combination of a short solid conductive prism and a long linewise perfect electric conductor. We find that this combined structure can approximate casing effects at a small fraction of the computational cost required for modeling a complete hollow casing because the linewise structure is volumeless and does not require an excessive number of small elements. We also find that steel-cased wells distant from sources and receivers can be modeled as simple linewise perfect electric conductors, further improving the computational efficiency. Using this approximation, the 3D EM algorithm presented here is well-suited to modeling many arbitrarily oriented steel-cased wells. After verifying the accuracy and efficiency of this approach using various examples, we performed a 3D borehole-to-surface/surface-to-borehole and surface EM inversion and determine that the inversion can image a deep localized target in the presence of steel infrastructure.