Yes, it is allowed to wild camp in Costa Rica. However, be aware that most police will not allow you to camp right on the sand but just behind it. Most of the time, you will have shadows from trees which is better anyway. Camping on the beach is forbidden by law, but we think it's for two crucial reasons.