أَخْبَرَنَا مُحَمَّدُ بْنُ إِسْمَاعِيلَ بْنِ إِبْرَاهِيمَ، قَالَ حَدَّثَنَا إِسْحَاقُ بْنُ يُوسُفَ الأَزْرَقُ، عَنْ زَكَرِيَّا بْنِ أَبِي زَائِدَةَ، عَنْ أَبِي إِسْحَاقَ، عَنِ الْبَرَاءِ بْنِ عَازِبٍ، قَالَ قَدِمَ رَسُولُ اللَّهِ صلى الله عليه وسلم الْمَدِينَةَ فَصَلَّى نَحْوَ بَيْتِ الْمَقْدِسِ سِتَّةَ عَشَرَ شَهْرًا ثُمَّ إِنَّهُ وُجِّهَ إِلَى الْكَعْبَةِ فَمَرَّ رَجُلٌ قَدْ كَانَ صَلَّى مَعَ النَّبِيِّ صلى الله عليه وسلم عَلَى قَوْمٍ مِنَ الأَنْصَارِ فَقَالَ أَشْهَدُ أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَدْ وُجِّهَ إِلَى الْكَعْبَةِ ‏.‏ فَانْحَرَفُوا إِلَى الْكَعْبَةِ ‏.‏

It was narrated that Al-Bara bin 'Azib said: "The Messenger of Allah (PBUH) came to Al-Madinah and prayed toward Bait Al-Maqdis for sixteen months, then he was commanded to face towards the Ka'bah. A man who had prayed with the Prophet (PBUH) passed by some of the Ansar and said: 'I bear witness that the Messenger of Allah (PBUH) has been commanded to face towards the Ka'bah' so they turned to face the Ka'bah." Translation Not Available

Book Ref: Sunan An Nisai Book 5 Hadith 489
Web Ref:  Sunan An Nisai Vol 1 Book 5 Hadith 490