Under the Family Law Act, s. 29, a surrogacy agreement results in the child being the child of the intended parents only if "after the child's birth, the surrogate gives written consent to surrender the child to an intended parent or the intended parents."
If the surrogate does not give this written consent to surrender, the child remains the child of the birth mother (s. 27) and the birth mother is the guardian of the child and the intended parents do not become parents or guardians.
Similarly, in Ontario, under the Children's Law Reform Act, s. 10, the intended parents become the child's parents only if the surrogate provides to the intended parent or parents "consent in writing relinquishing the surrogate's entitlement to parentage of the child." That consent "must not be provided before the child is seven days old."
It is not kidnapping or abduction under the Criminal Code for a guardian to take their own child when there are no other guardians.