Two goals from Antoine Griezmann looked to have Barca on course for the first trophy of the Ronald Koeman era, but Asier Villalibre's 90th-minute goal took the game to extra time.
Inaki Williams gave Athletic, who beat Real Madrid in the semifinal, the lead in the 94th minute. With time running out and Barca down 3-2, Messi was sent off for lashing out at Villalibre in frustration.
The Royal Spanish Football Federation's competition committee will meet this week to decide the Barca captain's suspension length.
Messi, 33, is certain to miss two matches, but that could be doubled, depending on how the competition committee categorizes the dismissal. The ban will be served across La Liga and the Copa del Rey.
Therefore, he will miss Thursday's Copa trip to third-division side Cornella and next weekend's game against Elche in La Liga. If the ban is longer, he could also miss the next round of the Copa if Barca progress and the match against Athletic at Camp Nou on Jan. 31.
Sunday's red card was the first Messi has received while playing for Barca's first team, a length of 753 matches. It was the fourth of his career, though, following one dismissal for Barca B in 2005 and two with Argentina, including one on his international debut that same year.