Burger, 40, joined the Scottish set-up in 2019, succeeding Grant Bradbury in the job. He oversaw one of the greatest successes in Scotland's history as they reached the Super 12s stage of the 2021 T20 World Cup, beating Bangladesh in the group stage.
They also inflicted defeat on West Indies at last year's T20 World Cup, and currently sit top of the ICC's World Cup League 2, with the top three teams advancing to this summer's qualifier for the 50-over tournament in India.
"We would like to thank Shane for the hard work he has put in with the team during the last four years," Toby Bailey, Interim Head of Performance said. "He has continued the development of the men's national team and it is clear that beating Full-Member nations is no longer a shock. We wish him all the best for the future and I am sure he will excel at Somerset and beyond.
"The team has moved onto new levels under his tenure, and he leaves the team in a great position going into an exciting season with two ICC World Cup qualifications to play for. Our search for a new head coach is already underway and we hope to make an appointment in good time for the summer fixtures."
Burger's tenure was significantly affected by the Covid-19 pandemic, with Scotland unable to fulfil a single men's senior international fixture from December 2019 until May 2021. It also encompassed the resignation of the entire Cricket Scotland board in 2022 after a damning report into allegations of racism.
His new role at Somerset will see the former Gauteng allrounder become lead batting coach at the club.
Burger said: "I have been fortunate to have coached the Scotland men's national team for the past four years. The journey has been a rewarding one both on and off the field for this group and to have played a role in that journey is something I am incredibly proud of.
"There have been many challenges thrown along the way, but we have managed to navigate our way through these and achieve some fantastic results. I am excited to be moving onto to a new adventure with Somerset where I will be taking on a different role and have no doubt it will keep developing me as a coach and person.
"I would like to thank everyone who played a role in this chapter, and I cannot thank you enough for your assistance, care, and support"