The Labour leader argued immigration was not the solution to a staffing crisis as he called for more recruitment from within the UK.
It came as new data revealed staffing issues were linked to two deaths at a Glasgow hospital in one month.
Scottish Health Secretary Humza Yousaf expects this winter to be "one of the most difficult NHS Scotland has faced".
About 6,000 nursing and midwifery posts are unfilled in Scotland's NHS, while the English health service is said to be facing its worst-ever staffing crisis.
In England, 34% of doctors joining the health service last year came from overseas - up from 18% in 2014.
Scotland's SNP government is spending £8m on hiring 750 nurses and midwives from overseas this winter.
Labour has pledged to take on an extra 7,500 medical students every year if the party wins the next general election.
In an interview on BBC Scotland's The Sunday Show, Sir Keir said those people would be trained into the NHS "from here".
Asked how many people he would be prepared to let into the country under a managed migration plan, he said: "We don't want open borders. Freedom of movement has gone and it's not coming back.
"So that means fair rules, firm rules, a points-based system.
"What I would like to see is the numbers go down in some areas. I think we're recruiting too many people from overseas into, for example, the health service.
"But on the other hand, if we need high-skilled people in innovation in tech to set up factories etc, then I would encourage that."
The Labour leader said he has daily conversations with his wife Victoria, who works in the NHS, about the health service's struggles.
Asked what she says is the problem with the NHS, Sir Keir replied: "We haven't got enough people."
On whether he believes immigration should be used to address that issue, he said: "I think that we should be training people in this country.
"Of course we need some immigration but we need to train people in this country."
Sir Keir's comments come after politicians and campaign groups criticised Home Secretary Suella Braverman's language about migrants.
Meanwhile data obtained by Scottish Labour using freedom of information legislation shows 336 related to "staffing/inappropriate skill mix" were recorded by NHS Greater Glasgow and Clyde between July 18 and August 18.
The incidents include two deaths at the Queen Elizabeth University Hospital, while there were 59 "near misses" recorded across the health board.
A further 14 incidents caused illness or injury - 10 of which occurred at QEUH, according to the figures.
NHS Greater Glasgow and Clyde confirmed investigations into the circumstances surrounding the two deaths were ongoing - but said the board could not comment further due to patient confidentiality.
Paul O'Kane, Scottish Labour's public health spokesman, said: "NHS workforce is overstretched and undervalued, and these terrifying figures are a glimpse of what will happen on a larger scale if the Scottish government's negligence continues."
Humza Yousaf, the health secretary, said: "The health service is facing a triple threat this winter - recovering from the worst effects of the pandemic, high energy costs and rising inflation, and the loss of much needed staff due to Brexit.
"Like health services across the UK and globally, we expect this winter to be one of the most difficult NHS Scotland has faced."
He said the Scottish government's £600m health and care plan was working to recruit 1,000 new NHS staff, including up to 750 nurses, midwives and allied health professionals from overseas - with the plan also focusing on the social care sector to try to alleviate delays.
The health secretary added that the government continues to "take positive action to promote patient safety", saying it had last month introduced the Patient Safety Commissioner Bill to Parliament.
"This legislation will further strengthen the patient voice within the healthcare system and take action to promote patient safety across our healthcare system as a whole," Mr Yousaf said.
Meanwhile a spokesman for NHS Greater Glasgow and Clyde said the Datix system - which collates data on adverse events - "may not give an entirely accurate picture of the situation", adding that on occasions where staffing issues are resolved quickly the system may not be updated.
He said: "We would like to extend our sympathy to families who have lost a loved one in our hospitals."
Sir Keir Starmer's interview on The Sunday Show is available on the BBC iPlayer.
Keir Starmer says the UK is recruiting too many people from overseas into the NHS