An addition to the proverb God, or the Lord, etc., helps those who help themselves, the imperative phrase God, or the Lord, etc., help those who are caught helping themselves originated as a warning to shoplifters.
These are the earliest occurrences that I have found, in chronological order:
1-: From one of the unconnected paragraphs making up the column Local Items, published in The Macon Mail (Tuskegee, Alabama, USA) of Wednesday 25th September 1878:
“God helps those who help themselves,”—“but God help those who are caught helping themselves in this store,” is the sign in the New York office of the Adams Express Company.
2-: From one of the unconnected paragraphs making up the column Local Brevities, published in The Democratic Advocate (Westminster, Maryland, USA) of Saturday 3rd December 1881:
A provision store in this city has the following placard upon the front window:—“The Lord helps those who help themselves. But the Lord help those who are caught helping themselves here.”
3-: From an article about the increase in the price of bread decided by the proprietors of the bakeries of Cleveland, published in The Cleveland Leader and Morning Herald (Cleveland, Ohio, USA) of Saturday 21st May 1887:
A Leader reporter yesterday made a tour of the down-town bakeries in order to learn why prices had been increased. In one of the large bakeries the manager sat with his sleeves rolled to the shoulder, amid a tempting array of white loaves. Above his head was a warning to hungry visitors as follows:—
God helps those who help themselves, but God help those who are caught helping themselves here.
4-: From one of the unconnected paragraphs making up the column Facts and Fancies, published in The Liverpool Echo (Liverpool, Lancashire, England) of Saturday 27th April 1889:
“Heaven helps those who help themselves, my son,” said the minister to Bobbie. “Yes,” replied Bobbie, whose hair was very short, “and heaven help those who are caught helping themselves.”
(Several Scottish newspapers reprinted this paragraph in June 1889.)
5-: From The Bairnsdale Advertiser and Tambo and Omeo Chronicle (Bairnsdale, Victoria, Australia) of Saturday 23rd May 1891:
The following notice is hung up in a Glasgow confectioner’s shop:—“The Lord helps those who help themselves; but the Lord help those who are caught helping themselves here.”