There must be an electrical issue with the system. The best thing to do is to have the computer scanned to see if there are any trouble codes relating to the transmission. With today's cars, there are so many sensors, computers, solenoids. That it becomes a guessing game without a scanner.
I don't know if you checked, but make sure the trans fluid is full and clean. If it is too low, it won't shift into drive.