My SiL did this with my neice, just for 'go to sleep' time. Once she was asleep the door was unlocked. It was done for nap time and bedtime. My neice was a very difficult child. If the door hadn't been locked, she would never have gone to sleep.
My DGS had a gate on his bedroom door for the same reason. Also because he would have (and did pre-gate) got up and wandered around the house. Given that he could walk and climb out of his cot from 9 months, it was too dangerous to consider.
Soops place of refuge and friends
