No it’s not necessary to repeat the subject pronoun (or the subject in general), however if there is an object pronoun, you’ll have to repeat the full verb. Your example would be:
J’ai préparé un repas et l’ai mangé.
As mentionned by Stéphane, you could also skip both the object pronoun and the auxiliary, but that would result in a slightly different meaning.
J’ai préparé un repas et j‘ai mangé.
(meaning “I cooked a meal and ate”, a bit different from “I cooked a meal and ate it”), would be shortened to:
J’ai préparé un repas et mangé.