I'm currently watching the 16th episode of Death Note, and this question is bothering me a lot about how the story is going. Why didn't Rem kill L when Misa was under police custody and instead chose to erase her memories? Even Light chose to go by Rem's choice. In the 15th episode, Light chose to kill L using Rem's help. I wonder why they didn't do this.
To put this shortly without spoilers, Rem knew Misa isn't gonna die because she's seeing her life span. The only reason she made Misa forfeiting the Death Note and lose all her memories, is because she couldn't see her suffering and trusted Light to help. Misa would never say anything about the Death Note or Light anyway.
For more detailed answer with spoilers (beware if you haven't watched episode 26):
To answer this, there's need to remember 2 important points about Shinigami: 1. That Shinigami can know each person life span. 2. That if Shinigami helps human to extend his life span, he dies. Following that, we can surely assume that Rem knew that Misa lifespan wasn't in danger when she was in jail, or she would Kill L as you said. If it wasn't like that, we can assume otherwise that she would kill L and die in the process, as it happens on ep26. What changes the situation between when Misa was arrested and after then Yotsuba arc, is Misa's life span. Misa life span got shortened twice, one when she got the Death Note, she had done the deal of the Shinigami eyes. Second, after regaining memories of the Death Note and made the eye deal again (following Light's order to make that happen). This made Misa's life span shortened to quarter of what she had before gaining the Death Note in the first place. Rem seeing that, she understood she's gonna die very soon, and that what made her to kill L in that moment. Unlike when Misa had been arrested, when she wasn't at her end.