Whenever twins are born, there is always a small time-interval between their birth. Generally, this interval is of around 10 minutes.
In the given riddle, the first baby would have been born just befor midnight of 31st December.
The other baby must have been born just after midnight on 1st January of the next year. In this way, twins can be born in different years.