Heroin can cause damage to many human organs, possibly leading to different types of arrhythmias and abnormal electrophysiological function of the heart muscle and the steady state of calcium-ion channels. We explored cardiomyocytes treated with heroin and the effect on calcium-ion channels. Transcriptomics and metabolomics were used to screen for differential genes and metabolite alterations after heroin administration to jointly analyze the effect of heroin on calcium channels in cardiomyocytes. Cardiomyocytes from primary neonatal rats were cultured in vitro and were treated with different concentrations of heroin to observe the changes in morphology and spontaneous beat frequency and rhythm by a patch clamp technique. Transcriptomic studies selected a total of 1,432 differentially expressed genes, 941 upregulated and 491 downregulated genes in rat cardiomyocytes from the control and drug intervention groups. Gene Ontology functional enrichment showed that 1,432 differential genes selected by the two groups were mainly involved in the regulation of the multicellular organismal process, response to external stimulus, myofibril, inflammatory response, muscle system process, cardiac muscle contraction, etc. Kyoto Encyclopedia of Genes and Genomes pathway enrichment analysis indicated that these genes were mainly concentrated in cardiac muscle contraction, osteoclast differentiation, adrenergic signaling in cardiomyocytes, dilated cardiomyopathy, hypertrophic cardiomyopathy, and other important pathways. Metabolomic testing further suggested that cardiomyocyte metabolism was severely affected after heroin intervention. After the treatment with heroin, the L-type calcium channel current I–V curve was up-shifted, the peak value was significantly lower than that of the control group, action potential duration 90 was significantly increased in the action potential, resting potential negative value was lowered, and action potential amplitude was significantly decreased in cardiomyocytes. In this study, heroin could cause morphological changes in primary cardiomyocytes of neonatal rats and electrophysiological function. Heroin can cause myocardial contraction and calcium channel abnormalities, damage the myocardium, and change the action potential and L-type calcium channel.