Some people are vegetarians.
Other people are religious and can only eat certain foods/forbidden from eating certain foods.
How was this dealt with?
On the Royal Navy's smaller ships, and the older capital ships, this problem was inherently solved by the system used. The crews were broken up into messes. The messes were issued with a general ration, and a sum of money with which to purchase additional foodstuffs. Two men from each mess would be selected to cook, with the duty circulating round each man in the mess on a rota system. This meant that if a member of a mess had particular dietary requirements, it could be accounted for without having to affect what everyone else on the ship ate. On the more modern ships, food for the whole ship was cooked in a central galley by specially trained cooks, with the messes having a much more limited input - cooks were still selected from each mess, but all they did was carry food from the galley to where the men ate. This system had less flexibility for men with dietary requirements, but there were generally vegetable or fish choices available. Officers had their own cooks under both systems, so wardrooms typically had a great variety of dishes. If an officer felt they weren't getting what they needed, they could request that their particular dietary needs be addressed, either by the cook or by the Mess Committee.