The four-year partnership with the broadcasting giants will see the national stadium in Edinburgh renamed as BT Murrayfield Stadium.
BT will also sponsor the Scotland sevens side, Scotland's domestic league and cup competitions and Scottish Rugby's four new academies.
"This is a momentous day for Scottish Rugby," the union's chief executive Mark Dodson told www.scottishrugby.org.
"We are very proud to bring BT back into our family of sponsors on a size and scale that is unprecedented both for Scottish Rugby and, we believe, Scottish sport.
"While the headlines may be dominated by the naming rights of the stadium, today's announcement underlines BT's alignment to our own values and goals, particularly that rugby clubs are the heart and soul of their communities that offer a welcome to all, young and old, boys and girls, men and women.
"This new funding underlines our desire to deliver more opportunities for young people to take up our game and broaden the reach of rugby across Scotland.
"We will invest the monies that we receive from BT alongside the revenues that come from our other partners to continue our plan to grow the game of rugby throughout Scotland and deliver against our strategic plan and our recent policy paper initiatives, in particular the establishment of a robust academy structure and to enhance the standard of club rugby."
Scottish Rugby's director of commercial operations, communications and public affairs, Dominic McKay, said: "We are delighted to have secured such a renowned and respected global partner. BT recognises the importance and the rich heritage associated with Murrayfield and Scottish Rugby.
"In branding our home, the BT Murrayfield Stadium it reiterates our joint view that the name of the home of Scottish rugby that has been synonymous with the game in our country since 1925 had to be retained.
"BT is a massive global brand, which we've worked with before as sponsor of our domestic league and cup competitions between 1999 and 2006. We also have the pleasure of working with BT Sport, which began its relationship with us at the start of this season, as it sponsors both Glasgow Warriors and Edinburgh Rugby.
"To secure a deal of this nature for the first time in our history means a huge amount for Scottish Rugby, as it will deliver very positively for us for years to come to enable us to continue to invest in our game throughout Scotland.
"I wish to place on record our thanks to RBS for their tremendous support of our domestic competitions and the Scotland sevens squad over the last three years and very much look forward to continuing to work with them as national team sponsor.
"We will be working closely with BT and their staff throughout Scotland in the coming months as we bring this new relationship to life."
Donald Macleod, president of the Scottish Rugby Union, said: "Congratulations to the executive team on securing such a great deal for the whole of Scottish rugby. From Stornoway in the north to Selkirk in the south, this welcome investment comes as a very positive development for the entire game."