Although United made a bright start to their quarter-final second leg at the Nou Camp with Marcus Rashford hitting the crossbar early on, they were soon outclassed by Barca, who eased to a 3-0 win on Tuesday for a dominant 4-0 aggregate victory.
"We were fighting against a great team and we know there's work to be done but I've said all along this isn't going to change overnight," Solskjaer told a news conference.
"The next few years are going to be massive to get to the level that Barcelona and other teams are at."
Solskjaer has restored United's confidence and overseen a vast improvement in results in his four months in charge since taking the job after Jose Mourinho was sacked in December, giving the team hope of a top-four finish in the Premier League.
He also led them to a historic comeback after a 2-0 first-leg defeat at home to Paris St Germain in the Champions League last 16, going through on away goals with a 3-1 win in the French capital.
Yet the scale of the long-term surgery his side needs was laid bare at the Nou Camp, where Barca walked all over United.
Messi pounced on a wayward pass by United captain Ashley Young to break the deadlock in the 16th minute while midfielder Fred also surrendered possession a few moments later and Messi again capitalised, with his shot squeezing under the usually excellent David de Gea.
"We've got good players to work with and at the moment we've done really well to get to the quarters and challenge for top four, but we've got a rebuilding job. It starts with the coaches and players, and with one or two additions," added the Norwegian.
"We're on with the job and have spoken to the players we need to get the best out of each other, create an environment of top class attitude, world class attitude every single day."
Barca scored their third goal when Philippe Coutinho was left with plenty of space and time to curl a shot into the top corner.
United's attack only troubled Barca keeper Marc-Andre ter Stegen once, when Alexis Sanchez was thwarted in the closing stages.
"You know that at this level you cannot slip up and make mistakes and you have to take your chances when you get them," Solskjaer added.
"We didn’t capitalise on our great start, then they have their first two shots on target, they get two goals then it's game over. We did well to get here but we could see the difference between the two teams."
Although United made a bright start with Marcus Rashford hitting the crossbar early on, they were soon outclassed by Barca, who eased to a 3-0 win, for a dominant 4-0 aggregate victory.