What would be correct: Youngest and oldest soldier cut the cake or youngest and oldest soldiers cut the cake, knowing that we are referring to only one youngest and one oldest?
Either is possible, but I think soldiers is preferable.
Either way, you need the:
The youngest and the oldest soldiers cut the cake.
Both choices are possibly ambiguous: soldiers doesn't make it completely clear that there are exactly two; whereas soldier might in principle mean one single person who was both extremes (though in the real world that can't happen if there is more than one soldier).