Ethereum is described as using and enabling the creation of "Smart Contracts", sometimes called just "contracts". But what is an Ethereum contract? Is it a legal document, or something else?
The terms "Contract", "Smart Contract", and sometimes "DApp" are all often used interchangeably to describe the same thing.
A "Contract" on Ethereum is a piece of code. This code is stored on the blockchain as bytecode and is immutable once created.
A Contract has an address similar to the way that normal private key based accounts have a public address. The difference is that contract addresses do not have an associated private key. In all other ways, contract addresses are treated the same as private key backed addresses.
When a transaction is sent to a contract's address, it triggers the execution of the contract's bytecode. A contract's code can do anything that a normal address can do, including sending funds to other addresses and calling code on other contracts. The only thing that a contract cannot do that a normal address can is initiating a transaction. Transactions on Ethereum must always be initiated by private key based addresses.
Contracts have 2 ** 256 32-byte storage slots available to store data in. This can be thought of as each contract having its own database available for keeping track of data that needs to be persisted through the lifecycle of a contract.
Most contracts are written in a high level language such as Solidity which compiles to bytecode that is deployable onto the Ethereum blockchain.
It is certainly not a legal document. Put simply it is just a piece of code embedded to a blockchain that has its own address that is being executed every time transactions to this address arrive. You can think of it as a contract that has strict logic defined by a code and there is nothing in existence that could stop this code to be executed if somebody pays for it. I wrote kinda Ethereum 101. Hope that helps.
An Ethereum Contract is programming code (as data stored in the blockchain) that you send money (ether) at, which it can decide (through smart contract logic and blockchain consensus) to delay, send on money, call other contracts, modify it's storage, signal outside observers, require two or more signatures, etc. Anything (nearly anything?) arbitrary programming can do, an Ethereum Contract can do (with enough developer hours and resources).
You can have your code be executed and verified on the Ethereum blockchain. (That is why it is sometimes referred to as "The World's Computer".) If you wanted to have property locked up in such a way that three people are needed over a one week period, or two people over a month period (but the third person can see what they're up to and perhaps negate their action), or any other problem that requires distributed trust (without a notary, lawyer, or judge to help enforce things), then Ethereum might be a great fit as a solution.
tl;dr: "Is it a legal document", No - but it might just replace the entire legal system.
...Smart contract is like a web site. A blockchain address may belong to a program. A program then is called a smart contract. It is called a contract just because the code is open. However it is simpler to compare it to a web site (or web service). For example, a classified advertisements service could be a smart contract. Its code would be stored at a particular address in the blockchain — just like a web site url. A transaction to this address would not contain money but an advertisement text. And the smart contract would publish this advertisement, i.e. saves to blockchain...
Smart Contract is an agreement or contract (because they contain instructions or command “if this is found, then this will happen"), that works on the Ethereum blockchain. These instructions or commands in the form of code are distributed throughout the whole Ethereum network. This distributed code is executed in the ETH blockchain because that smart contract which is written (in Solidity which is a programming language for ETH blockchain) contain functions which are required by user to be executed in the ETH network. To execute these smart contracts on the Ethereum network, you have to pay fee called “gas” for the nodes or computers on the network. The code or smart contract is distributed to all nodes (computers all over the world) and executed on an EVM Ethereum Virtual Machine. There are more features of smart contracts...i can go in deep but i think it's enough for this question.