A 2 year old can have an iPad but the 2 year old should not have the iPad for too long of a time and you should be sure that they are watching age appropriate content.
Most experts advise against giving a 2 year old an iPad or other tablet as a result of concerns about screen time and it's impact on their development.
It's recommended to limit screen time for children ages 2 to 5 years of age to 1 hour per day of high quality programming.
When my son who's now 3 was 2 years old he had an iPad but I would make sure he was only watching age appropriate cartoons on it and he only got it for a few hours a day.
Your 2 year old will be just fine when watching programs that are age appropriate for them on a tablet, iPad, TV computer etc.
Just limit the amount of screen time they get and ensure they are also staying physically active and getting outside to play as well.
A 2 year old shouldn't have an iPad all day or when alone but once in awhile it's okay for them to use them.