Online education platform Coursera said on Wednesday it would acquire rival Udemy in an all-stock deal that values the combined company at $2.5 billion, as the sector consolidates following a post-pandemic slowdown and increased investor scrutiny.