You can obviously write anything into a contract that you like. However, the laws of your country always apply, and the laws can tell you that some things are not valid, even if they are in a contract. Such things cannot be enforced. Things in a contract that are valid according to the laws can be enforced.
An extrem example would be a contract saying "user6726 pays gnasher $20,000, and gnasher kills user6726's spouse". Since killing your spouse is a very serious crime, even if we both signed it, and even if you paid the $20,000, you couldn't enforce me doing my side of the contract.
What does it mean if we say a contract can be enforced? It means if we both sign a contract, and you do your side of the bargain, and I don't do mine, then you can take me to court. If the court agrees, the court can order me to do what the contract says, and/or to pay you damages. If I refuse, the court has ways to "convince" me to do my side of the bargain. For example, they could send bailiffs to my home, who take my property and sell it in an auction to pay for what I should have paid. They can not in most countries send me to jail.
Sometimes one side cannot fulfil their side of the contract. If there is a contract that you build a brand new home for me, and I pay you a million dollar, but I not only don't have the money but am hugely in debt, then I can't pay you. Some people will say that you can't enforce your contract which is legally imprecise. You can take me to court etc., but you can't take money from my empty pockets.
I might be in trouble though if I signed the contract knowing that I can't pay you; that could be criminal fraud and I might go to jail if a judge and jury believe that I committed fraud.