It is possible to opt out of Social Security. Section 8807 of the Social Security Bulletin, April 1989/Vol. 52, No. 4 defines the criteria required to opt out.
One can opt out of Social Security under the “Amish exemption”. In 1954, Congress amended the Social Security Act to include agricultural workers. The Amish sect was heavily impacted due to their agrarian lifestyle. The law described Social Security as taxation and insurance coverage. The Amish do not believe in insurance. They believe in God, their hard work and their community to provide for them. They refused to pay, and many had their bank accounts levied. The Amish then closed their bank accounts. Unable to locate bank accounts, the Internal Revenue Service began to seize property. The IRS, in a famous 1961 enforcement action, seized and sold at auction 3 of 6 horses belonging to Valentine Byler. Byler and the Amish sect appealed the seizure in court. The court action created so much publicity, that the Medicare Act of 1965 included an exemption from paying Social Security taxes on religious grounds.
The Medicare Act of 1965 included a section which excluded Amish and other religious sects who objected to insurance on religious grounds. The sect must have been in existence since December 31, 1950. Mennonite, Anabaptist and a few smaller religious sects were later determined to be eligible under the exclusion. The explicit wording of the new legislation does not recognize opting out of Social Security for any religion which came into existence after 1950.
All the rumors which circulate about how to opt out of Social Security are fiction. The only way to opt out legally is to join a recognized religious sect. Trying any other method will result in IRS garnishment and enforcement actions.