The effects of berberine on cardiac function of heart failure after myocardial infarction and its possible mechanism were investigated. The anterior descending branches of 50 female Wistar rats were ligatured to establish the model of heart failure after myocardial infarction. At 4 weeks after successful modeling, the rats were randomly divided into two groups receiving 4-week gavage with saline (Sal group) and berberine (Ber group), while the sham-operation group (Sham group) was set up. After 4 weeks, the hemodynamics and serum BNP in rats were measured. The hearts of rats were taken to detect the degree of myocardial fibrosis. The myocardial cell apoptosis was detected. The expressions and changes in myocardial apoptosis-related proteins, including Bcl-2, Bax and caspase-3, were detected. The expression and changes in GRP78, CHOP and caspase-12 in myocardial tissue were detected. The results showed that Berberine improved the cardiac function of rats after myocardial infarction. After myocardial infarction, myocardial fibrosis and apoptosis were observed around the infarction area, berberine improved the myocardial fibrosis and reduced cell apoptosis. Furthermore, berberine alleviated endoplasmic reticulum stress (ERS) after myocardial infarction. In conclusion, Berberine can inhibit the myocardium cell apoptosis of heart failure after myocardial infarction, and its mechanism may be realized by affecting the ERS in myocardial tissue of heart failure after myocardial infarction and CHOP and caspase-12 apoptotic signaling pathway, upregulating Bcl-2/Bax expression and downregulating caspase-3 expression, thus inhibiting the cardiac remodeling and protecting the cardiac function.