International Business Machines Corp., taking a giant step into the telecommunications field, said yesterday it had agreed to buy 15 percent of Rolm Corp., a major producer of commercial and business telephone equipment, for $228 million.

The computer giant's action puts it squarely into competition with American Telephone & Telegraph Co. in the exploding, newly deregulated telecommunications market. It comes within days of news that American Bell, AT&T's new equipment division, is having growing pains that have resulted in a reorganization of the unit's top management.

The agreement, subject to Justice Department approval, is aimed at giving the two companies a powerful product line for the so-called "office of the future," in which terminals and other computer work stations are linked with large central computers to handle data and voice transmissions within or between companies. The competition in this area is already intense.

It also gives IBM an entree into the voice-communication field through some of Rolm's products and should strengthen IBM's position in the communication between personal computers and large, computerized central data files.

"Nothing is specified in our agreement on how we will cooperate, but nothing is precluded, either," said Richard Moley, Rolm's vice president for marketing.

It is the latest move by IBM to venture beyond its own, formidable boundaries to purchase interests in other companies with technology IBM wants--a dramatic change of course for the formerly self-contained computer firm. Last December, IBM bought 12 percent of semiconductor-maker Intel for $250 million and has also formed partnerships with Japanese electronics companies.

Founded in California 14 years ago and now a fast-growing $380.6 million company, Rolm's major products are private branch exchanges (PBXs), complex telephone switching devices that trace their roots to the old telephone switchboard. These devices, which are practically computers in themselves, are capable of transmitting electronic mail, providing automatic dialing services and turning a company's telephone network into a data network linking computers in several locations.

The PBX market is growing at a rate of 25 percent a year. Moley said AT&T makes about 50 percent of all new sales, with Rolm accounting for 12 percent in the larger units, which cost between $100,000 and $1 million each.

In the announcement yesterday, IBM also said it had obtained the right to increase its share of Rolm to as much as 30 percent. The companies also announced plans to negotiate "specific agreements providing for cooperative development efforts" and to pursue possible joint ventures outside the United States. The companies indicated that they would work at making Rolm equipment compatible with IBM computers, a feature analysts say Rolm is already on its way to achieving.

An AT&T spokesman, reacting to the IBM announcement, said yesterday, "There is formidable competition out there. This is just another striking example of what is happening in the marketplace and another reason why constraints now on some of the players, such as AT&T, ought to be off.

"This is the getting together of two very strong competitors," ths spokesman added.

The uncertainties that AT&T is facing as the markets it once monopolized become competitive are shaking the company's reputation as one of the nation's most solid corporations; Fortune magazine said this week that AT&T's stock, long one of Wall Street's safest bets, now "looks like just about the most uncertain buy around."

"I think AT&T is in trouble, and I think they are behind," Ed Spievack, president of North American Communications Association, a trade group representing telephone equipment makers such as Rolm, said yesterday." Spievack said that, in addition to giving IBM access to Rolm's markets, the agreement will improve Rolm's marketing potential overseas, where IBM is extremely strong.

"The business communications industry is in a state of rapid change, both domestically and internationally," Rolm President M. Kenneth Oshman said in a statement yesterday. "Rolm strengths in digital PBXs, combined with IBM's broad capabilities in information systems, will increase our ability to take advantage of the opportunities that are emerging in the marketplace."

His counterpart, IBM Chairman John R. Opel, said in a statement, "Communications and information processing are becoming increasingly integrated. We believe our customers will benefit from the enhancement of Rolm and IBM product connectibility."

With its agreement with Rolm, IBM can offer a wide range of computer-linked communications services to customers, from computers to switching devices to data transmission through its Satellite Business Systems partnership with Comsat and Aetna Life & Casualty Co.

In Rolm, IBM has linked up with one of the best-regarded companies in the telecommunications field, which is expected to announce shortly a new family of terminals that will include work stations that can communicate electronically between themselves, as well as equipment designed to make more efficient switches in telephone lines from voice to data use and to ease communication with, coincidentally, IBM equipment.

In a report on the PBX industry published this week, industry analyst Steven Chrust, of Stanford C. Bernstein & Co., a New York brokerage firm, wrote, "Rolm, after an extended period of development but no product announcements, is now emerging with a most impressive series of products."