You'd say it when someone left the front door open. You could also say "Close the door." At my grandmother's house, if someone left the door open she'd ask "Were you born in a barn?" It basically suggested that you had the manners of a barn animal and didn't know enough to close the door.