The 49ers selected Notre Dame offensive tackle Mike McGlinchey with the No. 9 pick in the NFL draft Thursday night.

The selection was a mild surprise because the position doesn’t appear to be an immediate need: The 49ers have Pro Bowl left tackle Joe Staley and right tackle Trent Brown.

However, Staley will turn 34 before the season opener and told reporters Monday a hip issue dogged him for the first half of the 2017 season and caused him to ponder retirement for the first time in his career. Meanwhile right tackle Trent Brown is the final year of his contract, is rehabbing from surgery from a torn labrum and has been dogged by weight issues that have inspired questions about his commitment during his four-year career.

As a result, the 49ers turned to McGlinchey, the second offensive lineman off the board after his teammate, guard Quenton Nelson, who went to the Colts with the No. 6 pick.

McGlinchey (6-foot-8, 309 pounds) was a two-time team captain who was a first-team All-American in 2017. A three-year starter, he played 13 games at right tackle in 2015 before starting 25 games at left tackle in his final two seasons.

The 49ers invested the No. 9 pick in McGlinchey after giving quarterback Jimmy Garoppolo a then-record $137.5 million contract in February. In March, they also beefed up their offensive front by signing center Weston Richburg to a five-year, $47.5 million deal. Their only other major free-agent signing also addressed the offense when they signed running back Jerick McKinnon to a four-year deal woth up to $36.5 million.

The selection of McGlinchey raises questions about Brown’s future with the team.

Unlike Staley, who was recently given a $6.4 million raise over the final two years of his contract (2018-19), Brown has not been given a contract extension.

On Monday, general manager John Lynch said he was no rush to give Brown an extension.

“There’s no urgency there,” Lynch said. “We don’t need to do anything right away. And I think Trent is working back into form (from surgery). We like Trent as a football player, but we can take our time on that.”

Brown’s size (6-foot-8, 355 pounds) means he’s not a prototypical tackle in an offense that places a heavy emphasis on offensive linemen’s movement skills. In his nine seasons as an offensive coordinator, Kyle Shanahan’s five primary right tackles had an average weight of 311 pounds.

On Monday, Staley, who is among the NFL’s lightest left tackles, said he plays around 295 pounds.

MORE TO COME