{At a restaursant}

For hear or to go?
Is this for here or to go?
It's for here, please.
It is to go, please.

(Are the expressions above all grammatical? What is the meaning of 'is to' in 'It is to go, please.'?
Does it mean 'must'? That is, "It (the food) must go, please." Am I right? Would you let me know the meaning of 'It is to go, please.'?)

It is all grammatically OK, but "hear" in the first line should be "here".

"To go" is in this case being used as an descriptive adjective phrase, not ans an unconjugated verb. It means that the purchased "food to go" will be taken out and not eaten in the place where it was purchased. The alternative is to eat the food "here".

The last two lines are contradictory alternative answers. The "please" is a nice touch but would usually be omitted in America, since the person buying the food is really just answering a question.

Yes, all of the expressions above are grammatically correct.

In the phrase "It is to go, please," the phrase "to go" means that the food is meant to be taken away. In this context, "to go" refers to the action of taking the food with you to eat elsewhere, outside of the restaurant.

In this case, "It is to go" means that the food that has been ordered is meant to be packed and taken away rather than being eaten at the restaurant. So, you are correct in understanding it as "It (the food) must go" or "I would like the food packed up and handed to me so I can take it with me."

Hope that clarifies it for you!