What would be the cost for the economy?
To achieve the goal they need to build new factories - for cars, for batteries, infrastructure to support recharging cars in a situation up to a level where everyone will be able to recharge, build energy source plants of any kind, upgrade the currently existing energy grid maybe - all that is not a problem in general.
The problem is that they should do so in short time, 2 years, but ok - that is understandable when thinking about global warming, etc., but as for the economy - what will those people do, who did the work, after the work is done? Barely 10% of them are needed to maintain and develop that system further.
The problem for the economy will be solving the existence of those 90%.
P.S.
Everything below is not the original answer, everything above is.
Notes, not answer related, and not OP Q related, but about comments and other answers, and some thoughts about electric cars and electric grid, using the UK as an example.
TL;DR The electric grid is not a problem and improving it will cost a few percent of cars as a price. The existence of all electric cars can improve the current capacities of electricity production and it needs only a few million electric cars. To fully enjoy those improvements 100% autonomous mode has to be enabled in those cars, however, it is not necessary.
- People started to discuss how is that doable at all considering the grid problems which electric cars will create. I see many free internet points for an answer which depicts all those difficulties, so I decided to summarize my comments in this answer, as I did some research (as I think) and have come up to a slightly different conclusion. As the UK was the main example in the most liked answer I decided to use UK data.
Grid
An interesting grid status for the UK can be found here
At the moment it looks like this:

As it shows on the gauges 45GW is ok, 55GW is almost ok, 70 GW max. The grid has no storage system and has up to 3.5GW export/import capabilities. (the gauges are wrong a bit, probably).
CCGT - combined cycle gas turbines: they are used to compensate peak for demands and they generate 22.5GW, which is almost half of the consumption.
Thanks to @Luaan's comment we have some data about cars and people in the UK as to what they produce - 800 billion passenger-miles per year or about 1,280 billion passenger-km per year.
Thanks to this video, shot at a Tesla center, the average is 290Wh/km (119'350'654kWh, 410'139'703 km). 210Wh/km is also practically achievable with a Tesla Model S, with 90 km/h speed limits. (not for X though, but it is expected that Tesla Model 3 will be more efficient in terms of Wh per km - because it will be a smaller car)
1,280 billion passenger-km per year means the UK has to add on average +42GW to its current power generation. 2 times more than they generate at the ok level, or to add 4/7 of what they can generate at maximum power production.
In 2014 there were about 31 million of cars in the UK, according to this source.
Looking at grid graphs, I see the average energy consumption/generation is about 32-33GW (from CSV average for this month is 33.7GW, so my eye guesses are good enough), in January about 37GW, February-March - something around 35GW.
Maximum for October-November was 48GW power consumption, the minimum was 22GW.
The difference between low and high during a day is about 15GW.
31 million electric cars with a 100kWh battery pack each are capable of storing up to 4 days of the average (32GW) energy production of the entire UK. This is a lot of buffer capacity.
If each car is connected to the grid for 6 hours a day they can backup 1 day of energy production for the UK. (not just for the peaks, but for the total energy production. For the peaks maybe 2 hours a day will be enough)
Grid energy production/consumption fluctuation, storage
The Wind can fluctuate from 0 to 8 GW - cars can average wind fluctuation completely for 16 days. Average wind for October-November is 2.5GW, dips in energy production are about 1 day long. Maximum for October-November was 6.6GW.
CCTG - average generation 17GW(Oct-Nov), 23.8GW maximum for the same period. This means they can produce +5.8GW on average and by that improve the cost efficiency of current installations. Potentially they can produce +30% more energy for the same installation price (which is about 1/3 of the generated energy cost, so about 10% improvement), and for higher maintenance cost, but they will work at a steady rate and that will improve their overall efficiency as a heat engine.
The nuclear average is 7.8GW, maximum is 8.34GW. The source says they work at maximum almost all time, energy fluctuations are the result of maintenance - so not much to gain here.
Coal - average 3.2GW, max 8.3GW - this source can produce +5.1GW, and used in average on 3/8 of its capacity, 100% use will increase efficiency in the same way as with CCTG.
Solar is not existing at the moment, so there are no numbers here.
Export - on average (October-November) the UK imports 0.6GW, peaks are -3.3GW:+3.3GW
Total
The UK grid can produce in its current state +10.9GW (Oct-Nov) with an average production of 33.7GW at the same period.
With an average price (US) of 100\$ per MWh - 784'800'000\$ per month or 9'417'600'000\$ per year, with exactly the same production capacity. (it is not profit, just turnover)
Also, it would be possible to export +3GW more energy from UK energy importers (by using export/input lines just for import only).
The UK could, with no capital costs for building new power plants, increase their power generation/consumption by about 14GW
- I am not sure about the grid itself, how much it can redistribute, but it looks like 18 oct 2016, 12:00-12:15 Dr. Who was able to recharge his Tardis at 130GW consumption rate - seems like there is no problem here. Joke. No problems here, just from common sense.
For cars they need 42GW, so they should improve their production by 28GW. Peak production is 48GW (October-November) and those 28GW will be about 58% increase in power generation capabilities.
An interesting document about electricity generation costs pdf, page 16. CCGT time to build (2-year development, 3 years building), fastest of them all as expected.
Wikipedia List of offshore wind farms in the United Kingdom: it looks like 3-4million £ per 1MW power. The cost of energy is about 2-3 times more than for CCTG.
This way CCTG +28GW - will cost about 28 billion £ to build. CCS adds about 10% to energy cost(at the moment) and wind turbines +28GW - will cost... I don't know, considering that they produce about 2 times less then they can, I do not know which MW to use, but 100 billions or more.
28 billion £ per 31 million cars - is about 1000 £ per car, with current prices on models S it is only a few percent of the cost of the car. So producing a car is a major problem in terms of capital costs.
Why a car is better than just a storage
Most of the time it is the end user, for that electricity.
With autonomous mode (google, amazon, Tesla) they can travel to a place where they are needed, and at a time when they are needed - to recharge themselves. They can be managed in a way which grid needs the most, at any given time day/night.
Where are people at the time, there is energy consumption increase - because they are at work (or at home) and it is very convenient if they (the people) bring not only themselves but also energy, for their work/home.
Parking buildings will be not just a waste of space for car storage, but also a part of the energy redistribution network, another way to stimulate solving a parking problem.
It is possible to share expenses of creating that battery on wheels between government/electric companies and the car owner.
Sharing a car as tesla master plan suggests, may reduce the amounts of cars needed to produce to cover transportation needs.
Why electric plants, which burn oil, are better than gasoline car
A few moments here.
They can be more efficient than the combustion engine of a car.
No need to produce different varieties of gasoline, cracking oil, refine oils - reduce wasting of energy, improve overall efficiency.
No need for gasoline additives - less pollution.
CO2 can be captured and stored (CCS - Carbon Capture and Storage) from those plants(in testing) and used by growing plants (in use in the Netherlands).
This may stimulate the use of carbon conductors (NASA is working on that for air/space crafts). The motivation is not just to capture and store carbon, but use carbon (partial burning). Improvements in carbon CNT manufacturing will improve many technologies, including electricity generation and transfer. And may actually reduce Aluminum and Fe production and save energy we use to produce this stuff.
P.P.S
Those notes are not necessary for this answer, but it just so happened.