Some countries effectively have exactly that: There are "baby boxes" on the public facing walls of hospitals where you can put a newborn (sometimes older children too) and walk away, no questions asked. The child is assigned a name and put into social care together with other people who have no parents or other guardians.