That's very complicated and depends on a lot of factors. Some overly simplified situations would be:
If one parent is choosing to put up a child for fostering/adoption because they don't feel they can raise the child, then in most cases there has to be the consent of both biological parents.This can have a time limit on it though, if one biological parent is out of contact.
If the child is in a situation where he is being put up for fostering/adoption because the state considered their home situation to be unsafe, the only way to retain your child is to change the home situation so it is no longer unsafe in the eyes of the state.
In any case you should probably contact a local social worker for help and maybe consider contacting a lawyer.