Originally used to say "you left the door open", based on the fact that barn doors were left open by farmers to let animals in or out.
More recently, it has been used to simply
indicate that a person is
ignorant or uneducated as if they were brought up on a farm.