Here's the solution, and a proof of its optimality:
This solution has 38 turns.
First, an important fact:
Any row, or section of a row that is blocked on both sides, with an odd number of cells must have at least one non-turn. This is because every cell with a turn has exactly one horizontal (and one vertical) half-segment, but every horizontal half-segment connects to a partner in the same row.
This also shows that every row must have an even number of "turns plus horizontal endpoints". And of course, the same argument applies to columns, but replacing 'horizontal' with 'vertical'.
Now, analysing the grid:
The grid has 46 cells in it. I've marked four regions in different colors.
The blue cells cannot have turns in them; there are 2 of those.
There must be at least 1 non-turn in the red cells. (The only way to get both of the left ones to turn is to make a C shape, but then if the right ones both turn you've formed a tiny loop.)
The 1 yellow column, and each of the 4 purple columns, must each have at least one non-turn, by the "important fact" above.
This gives an upper bound of 46 - (2+1+1+4), or 38 cells.
Constructing the solution:
All gray cells must then be turns, and we must have 3 turns in the red region and 2 in the yellow. So that gives this:
At least one of the red dotted lines will be taken, and exactly one of the yellow dotted lines will be taken. Each dotted line, if taken, turns cells 3-7 of the row it is in into an odd row; these must be the positions of the four non-turns in the pink region, and so the rows that do not have dotted lines (3, 7, and either 1 or 2) are entirely turns.
The cell in row 1, column 6, cannot be a turn. So the upper red dotted line must be used, and that must be the non-turn in its row.
If the top yellow dotted line is taken, the 3x3 region in the middle is closed off. So the bottom yellow dotted line must be taken instead. Row 4 must then be full of turns, and row 6 must have its non-turn in column 3 to not create a small loop:
Then from here, we can either skip the top right or bottom right cell of the central 3x3 area. Either leads to a valid 38-turn solution.