The modern view of male actors has coloured this question somewhat. We’ve had decades now of people like Chris Hemsworth on the big screen…
And he is only one of many modern actors who do extensive exercise and bulking up and ‘cutting’ to look like this.
But in the 60s only body builders really did the work to bulk like this and they never cut like Hemsworth does because cutting involves not having any water for a period before the shoot. Actors who look like this are usually dehydrated when they do the topless shots.
So, there was a different set of expectations for a male actor in the 60s. A little extra fat was OK, no one was expecting to see perfect abs and chiselled pecs.
Though, to be fair, Shatner did still get a lot of comments on his weight, certainly in the later years of Trek and when the films started appearing. Rumours he wore a corset in the films, that the uniform he wore was deliberately styled to hide his belly and so on.
The wrap around style might have been more forgiving of a larger belly than the tighter fitting uniforms the rest of the crew wore. And at least one other answer here has pointed out that he apparently put on weight really easily and had a struggle with being on set with the tables of food available.
But most of the shirtless scenes are in the early days and Shatner wasn’t that bad in comparison with similar stars of the time.
This is Sean Connery, James Bond as was. Note the lack of chiselled physique.
There are other examples. Fact is, even the leading man of a major action blockbuster of the time wasn’t rocking the washboard abs and huge biceps we see today. No one was expecting a male lead to display much in the way of musculature. It wasn’t really until the 80s when we started seeing the specialised musculature of Stallone and Schwarzenegger and I think things really took off with 300 and the Spartan training the actors in that did, which is indicative of the extremes modern actors have to go through to maintain their look.