Barca had not reported any injury to their star striker before kick-off at the Camp Nou. Ernesto Valverde may have opted to rest the Argentinian in the middle of a busy period of the season.
After Leganes, Barcelona face two midweek games against Sevilla in the Copa del Rey quarter-finals, either side of league fixtures against Girona and Valencia.
It is only the third time this term that Messi has not been named in the team, after Barca drew the previous two matches against Athletic Bilbao and Tottenham.
Ivan Rakitic was also a substitute against Leganes as Thomas Vermaelen and the 21-year-old Carles Alena were handed starting spots.
Barcelona have won their last six La Liga matches in a row. They had their lead at the top of the table cut to seven points after Atletico Madrid beat Huesca 3-0 on Saturday.