Imagine the following situation: You work in the morning until 1 PM, stand up, go for lunch, and meet a colleague in the hall. He says “Mealtime!”, so you reply with “Mealtime!”, and both of you go your own way and don’t say anything else.
Does it sound surreal? Well, that’s exactly what happens in Germany every day. Just like we say “Good morning!” when it’s morning, “Good afternoon!” when it’s afternoon, and “Good evening!” when it’s evening, Germans used to say “Good mealtime!” (Gesegnete Mahlzeit, literally “blessed mealtime”) when it was mealtime.
Just like it wouldn’t surprise you to hear just “Morning!” in English, “Blessed mealtime!” used to be shortened to “Mealtime!” (Mahlzeit!) so often that the original expression died out. (Note that in most parts of Germany, the use of Mahlzeit! is limited mostly to lunchtime, although there are parts where you can say it all day long.)
And what is the appropriate response to “Mahlzeit!”? Most of the time, you can say simply Mahlzeit!, just like you would reply with “(Good) morning!” to “Good morning!”. When someone says it when you are already eating (and they are not), it can be interpreted also as a form of saying “enjoy your meal”; then, instead of Mahlzeit!, you can say also Danke! (“Thanks.“)