There is no single answer to this questions, since the outcome is always dependent on your particular situation.
If you and your ex have already come to a written agreement about the custody of the children you had together, then a court may be reluctant to interfere with it. If there is no written agreement, the decision can be made once you and your ex hire a mediator to hammer out an arrangement, or else go to court to have one imposed on you.
If an Ontario court does get involved, then it will consider the relevant family legislation (the Divorce Act, the Family Law Act, and the Children’s Law Reform Act). This legislation mandates the court to keep several objectives uppermost in its considerations, the prime one being the best interests of your children.
This means there are no set rules. For example, there is no “presumption” that the mother will get custody over the father, even if the children are young.
See this article for more on determining child custody: Determining Child Custody After Separation.