It means to abide by the customs of a society when one is a visitor. or when you are visiting a different place or culture, you should try to follow their customs and practices.
معنی این Idiom اینه که وقتی یه جایی میری ( شهر یا کشور و غیره) باید خودت رو با هنجارها و آداب و موازین اونجا وفق بدی و مانند اونا رفتار کنی