For thousands of IBM employees, the ability to work from home is a key advantage of their job. But the company said Friday that it's ending that benefit for many of them.

The technology giant has been a leader in terms of letting employees work from home, and has bragged about the savings and increased productivity that's resulted. About 40% of its nearly 400,000 employees worldwide did not have a traditional office, the company said in 2007, which the last time it released such data.

But now the company is changing its policy, and many of its employees will have to reacquaint themselves with office life.

"In many fields, such as software development and digital marketing, the nature of work is changing, which requires new ways of working," said a statement from the company. "We are bringing small, self-directed agile teams in these fields together." The policy change was reported earlier by the Wall Street Journal.

Related: Three reasons your boss doesn't want you to work from home

IBM declined to say how many employees will have to return to the office, or where they will be located. It did say some will still be able to work remotely.

The vast majority of workers who have been asked to return the office have agreed to do so, IBM said. The company added that while some exceptions to the policy will be made, some employees will lose their jobs if they're unwilling to work in offices.

Related: Dell really wants you to work from home - if you want to

It wasn't that long ago that IBM (IBM) was touting the benefits of having so many of its workers work remotely.

Between 1995 and 2008, the company said it reduced its office space by 78 million square feet, and that 58 million square feet of that space was sold for a gain of $1.9 billion.

It's not clear how much it will have to spend to get employees back to the office.

IBM is not the only tech company to pull some of its employees back. Yahoo (YHOO) CEO Marissa Mayer sparked a controversy there four years ago when she also changed the policy to bring work-at-home employees back to the office.