Obama probably ordered Petraeus to be spied on.
It is more likely that the information was obtained before the General was appointed to the CIA. It would have been seen as a "handle," to control him--for a variety of possible reasons--including an ability to shoot him down, if he became a political rival.
For those who remember what happened to Vice President Agnew, my point will seem obvious. Agnew had been a member of the Rockefeller wing of the Republican Party, before Nixon put him on the ticket as Vice Presidential candidate in 1968. Agnew then moved to the right, and became something of a Conservative spokesman. Then suddenly in 1973, when it began to look like Nixon might be impeached, a pre-1968(!) tax investigation, suddenly came to a head, and Agnew was forced to resign--preventing the possible elevation of a Conservative to the Presidency. (It was obvious that someone had contol over that investigation, and had held same as an "ace in the hold," as it were.)