Tesla Motors said Tuesday it would bid to buy SolarCity, sending the solar energy company's shares higher.